Remove unused exn and example code
* Remove exn:fail:cookie, since I’d rewritten the library code to avoid using it. * Correct docs for cookie-header->alist, to reflect not raising the exn. * Remove needless illustration of date from clear-cookie-header example.
This commit is contained in:
parent
a01e93b515
commit
c3ce72e229
|
@ -170,16 +170,10 @@ HttpOnly} for more info.)
|
||||||
@examples[
|
@examples[
|
||||||
#:eval cookies-server-eval
|
#:eval cookies-server-eval
|
||||||
(clear-cookie-header "rememberUser" #:path "/main")
|
(clear-cookie-header "rememberUser" #:path "/main")
|
||||||
(require racket/date)
|
|
||||||
(date->string (seconds->date (current-seconds) #f) #t)
|
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@defstruct*[(exn:fail:cookie exn:fail) ()]{
|
|
||||||
Raised when a cookie (or component thereof) is malformed or can't be parsed.
|
|
||||||
}
|
|
||||||
|
|
||||||
@defproc*[([(cookie-header->alist [header bytes?])
|
@defproc*[([(cookie-header->alist [header bytes?])
|
||||||
(listof (cons/c bytes? bytes?))]
|
(listof (cons/c bytes? bytes?))]
|
||||||
[(cookie-header->alist [header bytes?]
|
[(cookie-header->alist [header bytes?]
|
||||||
|
@ -189,10 +183,8 @@ Raised when a cookie (or component thereof) is malformed or can't be parsed.
|
||||||
alist of all cookie name/value mappings in the header. If a
|
alist of all cookie name/value mappings in the header. If a
|
||||||
@racket[decode] function is given, applies @racket[decode]
|
@racket[decode] function is given, applies @racket[decode]
|
||||||
to each key and each value before inserting the new
|
to each key and each value before inserting the new
|
||||||
key-value pair into the alist. Raises an
|
key-value pair into the alist. Invalid cookies will not
|
||||||
@racket[exn:fail:cookie] if the header can't be parsed into
|
be present in the alist.
|
||||||
a sequence of name/value pairs (but does not check that the
|
|
||||||
byte-string obeys all the cookie formatting requirements).
|
|
||||||
|
|
||||||
If a key in the header has no value, then @racket[#""], or
|
If a key in the header has no value, then @racket[#""], or
|
||||||
@racket[(decode #"")] if @racket[decode] is present, is
|
@racket[(decode #"")] if @racket[decode] is present, is
|
||||||
|
@ -209,7 +201,6 @@ Raised when a cookie (or component thereof) is malformed or can't be parsed.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@defproc[(cookie->string [c cookie?])
|
@defproc[(cookie->string [c cookie?])
|
||||||
string?]{
|
string?]{
|
||||||
Produces a string containing the given cookie as text.
|
Produces a string containing the given cookie as text.
|
||||||
|
|
|
@ -34,10 +34,6 @@
|
||||||
bytes?)]
|
bytes?)]
|
||||||
[cookie->string (-> cookie? string?)]
|
[cookie->string (-> cookie? string?)]
|
||||||
|
|
||||||
(struct (exn:fail:cookie exn:fail)
|
|
||||||
([message string?]
|
|
||||||
[continuation-marks continuation-mark-set?]))
|
|
||||||
|
|
||||||
#:forall X
|
#:forall X
|
||||||
[cookie-header->alist
|
[cookie-header->alist
|
||||||
(case-> (-> bytes? (listof (cons/c bytes? bytes?)))
|
(case-> (-> bytes? (listof (cons/c bytes? bytes?)))
|
||||||
|
@ -82,10 +78,6 @@
|
||||||
#:path path
|
#:path path
|
||||||
#:domain domain)))
|
#:domain domain)))
|
||||||
|
|
||||||
;; For failure to parse a cookie on the server side:
|
|
||||||
;; FIXME I'm not sure I like raising exns for this.
|
|
||||||
(struct exn:fail:cookie exn:fail ())
|
|
||||||
|
|
||||||
;; bytes? [(bytes? -> A)] -> (AList A A)
|
;; bytes? [(bytes? -> A)] -> (AList A A)
|
||||||
;; Given the value from a Cookie: header, produces an alist of name/value
|
;; Given the value from a Cookie: header, produces an alist of name/value
|
||||||
;; mappings. If there is no value, the empty byte-string (or whatever
|
;; mappings. If there is no value, the empty byte-string (or whatever
|
||||||
|
|
Loading…
Reference in New Issue
Block a user