mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +02:00
Extend handling of "Cache-Control" header.
* module/web/http.scm ("Cache-Control"): Value for `max-stale' is optional. Strict validation for value-less directives (`no-store', etc.). String values optional for "cache-extension" directives. * test-suite/tests/web-http.test: Value for `max-stale' is optional.
This commit is contained in:
parent
cc8afa2b36
commit
321770b2a3
2 changed files with 11 additions and 3 deletions
|
@ -1240,19 +1240,25 @@ phrase\"."
|
||||||
(declare-key-value-list-header! "Cache-Control"
|
(declare-key-value-list-header! "Cache-Control"
|
||||||
(lambda (k v-str)
|
(lambda (k v-str)
|
||||||
(case k
|
(case k
|
||||||
((max-age max-stale min-fresh s-maxage)
|
((max-age min-fresh s-maxage)
|
||||||
(parse-non-negative-integer v-str))
|
(parse-non-negative-integer v-str))
|
||||||
|
((max-stale)
|
||||||
|
(and v-str (parse-non-negative-integer v-str)))
|
||||||
((private no-cache)
|
((private no-cache)
|
||||||
(and v-str (split-header-names v-str)))
|
(and v-str (split-header-names v-str)))
|
||||||
(else v-str)))
|
(else v-str)))
|
||||||
(lambda (k v)
|
(lambda (k v)
|
||||||
(case k
|
(case k
|
||||||
((max-age max-stale min-fresh s-maxage)
|
((max-age min-fresh s-maxage)
|
||||||
(non-negative-integer? v))
|
(non-negative-integer? v))
|
||||||
|
((max-stale)
|
||||||
|
(or (not v) (non-negative-integer? v)))
|
||||||
((private no-cache)
|
((private no-cache)
|
||||||
(or (not v) (list-of-header-names? v)))
|
(or (not v) (list-of-header-names? v)))
|
||||||
|
((no-store no-transform only-if-cache must-revalidate proxy-revalidate)
|
||||||
|
(not v))
|
||||||
(else
|
(else
|
||||||
(not v))))
|
(or (not v) (string? v)))))
|
||||||
(lambda (k v port)
|
(lambda (k v port)
|
||||||
(cond
|
(cond
|
||||||
((string? v) (display v port))
|
((string? v) (display v port))
|
||||||
|
|
|
@ -83,6 +83,8 @@
|
||||||
'((private . (foo))))
|
'((private . (foo))))
|
||||||
(pass-if-parse cache-control "no-cache,max-age=10"
|
(pass-if-parse cache-control "no-cache,max-age=10"
|
||||||
'(no-cache (max-age . 10)))
|
'(no-cache (max-age . 10)))
|
||||||
|
(pass-if-parse cache-control "max-stale" '(max-stale))
|
||||||
|
(pass-if-parse cache-control "max-stale=10" '((max-stale . 10)))
|
||||||
|
|
||||||
(pass-if-parse connection "close" '(close))
|
(pass-if-parse connection "close" '(close))
|
||||||
(pass-if-parse connection "Content-Encoding" '(content-encoding))
|
(pass-if-parse connection "Content-Encoding" '(content-encoding))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue