Repository navigation
typed/web-server/http: update types (typed-racket-more v1.10) - #817
Conversation
|
Note: This should build against any version of the |
|
LGTM |
| ;; For backwards compatability: | ||
| ;; these bindings are not exported by web-server/http, | ||
| ;; but they were exported by previous versions of | ||
| ;; web-server/http based on net/cookie. |
There was a problem hiding this comment.
Not relevant to this PR, but was this a backwards-incompatible change to web-server/http in the past?
There was a problem hiding this comment.
If you mean the exported names: no. Line 86 should have said ;; typed/web-server/http based on net/cookie. (I will submit a correction shortly.) The names cookie?, cookie-name?, cookie-value?, and valid-domain? are not and never were provided by untyped web-server/http: they were only provided by typed/web-server/http.
If you mean about the underlying change: this was discussed at racket/web-server#20. IIRC the conclusion was basically that web-server/http had tried very hard to avoid making promises about its internal representation of cookies (e.g. it did not provide cookie?). So we took pains to keep the web-server/http API compatible (e.g. parsing dates provided as strings …), but ultimately wanted to track the underlying change in the web.
There was a problem hiding this comment.
The fact that typed/web-server/http previously provided a different opaque Cookie type than typed/net/cookie (the deprecated one) seems to be consistent with that rationale.
There was a problem hiding this comment.
@samth One difference I just thought of is that previously, the predicates could be used for occurrence typing (e.g. cookie-name? for Cookie-Name). The actual representation hasn't changed (they were and are still Strings, with slightly different well-formedness checks), but that might make some programs now fail to typecheck. I can add little wrappers to attach a String proposition.
samth
left a comment
There was a problem hiding this comment.
This is great. I particularly appreciate the comments.
|
This build failure seems like a problem, though: https://travis-ci.org/racket/typed-racket/jobs/515528872#L497 |
7feabf1 to
3b64a43
Compare
- Weaken the types of `response-output` and the `#:output` argument to `response/output` from `Void` to `Any`, corresponding to <racket/web-server@a93685> and v1.2 of the `web-server-lib`. The return type should really be `AnyValues` to match the contract `any`, but Typed Racket can't generate a contract for `AnyValues`. - Update the types for cookie-related functions to reflect the re-implementation based on `net/cookies/server` from <racket/web-server@7974d4d>. This commit adds only as much of `typed/net/cookies/server` and `typed/net/cookies/common` as needed for `typed/web-server/http`. - Document that `net/cookie` is deprecated. - Update the types for `valid-id-cookie?` and `request-id-cookie` to support the `#:shelf-life` argument added in <racket/web-server@626ad02>. - Add the value `temporarily/same-method` with the type `Redirection-Status`, corresponding to <racket/web-server@4601f4>. - Correct the types of `response-seconds` and the corresponding arguments to `response/full`, `response/output`, and `response/xexpr` to use `Real`. While this corresponds to <racket/web-server#61>, using response values containing complex numbers would cause runtime errors even before this: the `response-seconds` is passed to `seconds->date`.
3b64a43 to
4a4b9b9
Compare
|
@samth I've fixed the build failure you linked to. This new failure should just be because racket/web-server#61 hasn't gone into the snapshot yet: https://travis-ci.org/racket/typed-racket/jobs/515881390#L630-L635 |
|
The build now seems to be passing: https://travis-ci.org/racket/typed-racket/builds/515881389 |
Weaken the types of
response-outputandthe
#:outputargument toresponse/outputfrom
VoidtoAny, corresponding toracket/web-server@a93685
and v1.2 of the
web-server-lib.The return type should really be
AnyValuesto match the contract
any,but Typed Racket can't generate a contract for
AnyValues.Update the types for cookie-related functions
to reflect the re-implementation based on
net/cookies/serverfrom racket/web-server@7974d4d.
This commit adds only as much of
typed/net/cookies/serverand
typed/net/cookies/commonas needed fortyped/web-server/http.Document that
net/cookieis deprecated.Update the types for
valid-id-cookie?andrequest-id-cookieto support the
#:shelf-lifeargument added inracket/web-server@626ad02.
Add the value
temporarily/same-methodwiththe type
Redirection-Status, correspondingto racket/web-server@4601f4.
Correct the types of
response-secondsand thecorresponding arguments to
response/full,response/output, andresponse/xexprto use
Real.While this corresponds to
strengthen contracts on
response-codeandresponse-secondsweb-server#61,using response values containing complex numbers
would cause runtime errors even before this:
the
response-secondsis passed toseconds->date.