Stricter cookie contracts

svn: r18629

original commit: e69a18eefd90a336e7f4b8305485732ea5896727
This commit is contained in:
Jay McCarthy 2010-03-26 16:07:35 +00:00
commit 3f01662a45
2 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,7 @@
#lang scheme/signature #lang scheme/signature
cookie-name?
cookie-value?
cookie? cookie?
valid-domain? valid-domain?
set-cookie set-cookie

View File

@ -294,11 +294,12 @@
;; ;;
;; Returns whether this is a valid string to use as the value or the ;; Returns whether this is a valid string to use as the value or the
;; name (depending on value?) of an HTTP cookie. ;; name (depending on value?) of an HTTP cookie.
(define (cookie-string? s [value? #t]) (define (cookie-value? s)
(unless (string? s) (and (string? s)
(error* "string expected, received: ~a" s)) (rfc2109:value? s)))
(if value?
(rfc2109:value? s) (define (cookie-name? s)
(and (string? s)
;; name: token ;; name: token
(rfc2068:token? s))) (rfc2068:token? s)))