* module/web/http.scm ("Content-Disposition"): Add a parser and
serializer. Defined in RFC2616 section 19.5.1.
* test-suite/tests/web-http.test ("entity headers"): New test case.
* module/web/http.scm ("Host"): Parse and write IP-literals treating
escapes as uri module does: remove brackets on parse, replace them on
write.
* test-suite/tests/web-http.test ("request headers"): Add tests.
* module/web/http.scm ("Cache-Control"): Write string values using the
default val writer, to get quoting correct.
* test-suite/tests/web-http.test (pass-if-round-trip): New helper.
("general headers"): Check that cache-extensions round trip properly.
* 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.
* module/web/http.scm (declare-symbol-list-header!): New helper.
("Connection"): Redefine as a header list.
("Allow", "Content-Encoding", "Accept-Ranges"): Redefine as symbol
lists.
* test-suite/tests/web-http.test:
* test-suite/tests/web-response.test: Adapt tests.
* module/web/http.scm (parse-media-type): Parse media types as symbols.
(parse-key-value-list, parse-param-component, parse-param-list):
Change kons to val-parser. Always parse keys as symbols, and always
either cons, if there is a val, or just have the key, if there is no
val. Easier to explain and just as correct.
(declare-param-list-header!, declare-key-value-list-header!): Adapt to
key-list and param-list kons change.
("Cache-Control", "Pragma", "Transfer-Encoding", "Accept", "Expect")
("TE"): Likewise, adapt.
("Content-Type"): Param keys are symbols.
* module/web/http.scm (declare-header!): No need to specify `sym', as it
can be derived from `name'. Change to take parser, validator, and
writer as positional arguments, and multiple? as a keyword.
(parse-header): Change to take the header as a symbol already, and
just return the parsed value. All headers are symbols now, including
unknown headers. I feel OK doing this given that the symbol GC works
now.
(lookup-header-decl): Only look up headers by symbol.
(read-header): Adapt to parse-header change.
(valid-header?, write-header): Adapt to all headers being symbols.
(split-header-names, list-of-header-names?, write-header-list):
Represent all header names as symbols.
(declare-opaque-header!, declare-date-header!)
(declare-string-list-header!, declare-header-list-header!)
(declare-integer-header!, declare-uri-header!)
(declare-quality-list-header!, declare-param-list-header!)
(declare-key-value-list-header!, declare-entity-tag-list-header!):
Change to be functions instead of syntax, and no need to specify the
symbolic name. Update all header declarations accordingly.
* module/web/request.scm (validate-headers):
* module/web/response.scm (validate-headers): Adapt to all headers being
symbols.
* test-suite/tests/web-http.test (pass-if-parse, pass-if-any-error)
(pass-if-parse-error): Update for parse-header change.
("general headers"): Update header list examples to be all symbols.
* module/web/http.scm (list-of-strings?, write-list-of-strings): Move
definitions up.
(split-header-names, list-of-header-names?, write-header-list): New
helpers.
(declare-header-list-header): New helper.
(cache-control): Use split-header-names for private and no-cache.
(trailer): Use declare-header-list-header to parse known headers to
symbols.
(vary): Likewise, use split-header-names et al.
* test-suite/tests/web-http.test ("general headers"): Add a test.
* module/web/http.scm: Add commentary.
(parse-quality): Allow .NNN to be interpreted as 0.NNN.
* test-suite/tests/web-http.test ("request headers"): Add a test.
* module/web/http.scm (parse-media-type, validate-media-type,
(content-type): Change to represent media types as ("foo/bar" ("param"
. "val") ...) instead of ("foo" "bar" ("param" . "val") ...). Seems to
be more in line with what people expect.
* test-suite/tests/web-http.test ("entity headers"): Add content-type
test.
* test-suite/tests/web-response.test ("example-1"): Adapt expected
parse.
* module/web/http.scm: New module, declares known HTTP headers, and
their parsers and unparsers.
* test-suite/tests/web-http.test: Add test suite.
* module/Makefile.am:
* test-suite/Makefile.am: Adapt.