1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

better cache-control: private, no-cache parsing

* module/web/http.scm (cache-control): Parse private and no-cache
  better.
* test-suite/tests/web-http.test ("general headers"): Update.
This commit is contained in:
Andy Wingo 2010-12-16 17:56:03 +01:00
parent ac7f17e3ca
commit 25731543d4
2 changed files with 12 additions and 3 deletions

View file

@ -966,7 +966,12 @@ phrase\"."
((max-age max-stale min-fresh s-maxage)
(cons k (parse-non-negative-integer v-str)))
((private no-cache)
(cons k (if v-str (split-and-trim v-str) #t)))
(if v-str
(cons k (map (lambda (f)
(or (and=> (lookup-header-decl f) header-decl-sym)
f))
(split-and-trim v-str)))
k))
(else (if v-str (cons k v-str) k))))
default-kv-validator
(lambda (k v port)

View file

@ -76,9 +76,13 @@
(pass-if-parse cache-control "no-transform" '(no-transform))
(pass-if-parse cache-control "no-transform,foo" '(no-transform "foo"))
(pass-if-parse cache-control "no-cache" '((no-cache . #t)))
(pass-if-parse cache-control "no-cache" '(no-cache))
(pass-if-parse cache-control "no-cache=\"Authorization, Date\""
'((no-cache . (authorization date))))
(pass-if-parse cache-control "private=\"Foo\""
'((private . ("Foo"))))
(pass-if-parse cache-control "no-cache,max-age=10"
'((no-cache . #t) (max-age . 10)))
'(no-cache (max-age . 10)))
(pass-if-parse connection "close" '("close"))
(pass-if-parse connection "close, foo" '("close" "foo"))