* module/web/request.scm (build-request): Make sure that HTTP/1.1
requests have the Host header set, per RFC 2616 section 9.
* test-suite/tests/web-request.test ("example-1"): Add test.
* module/web/request.scm (build-request): Make URI a positional
argument.
* module/web/response.scm: Remove extend-response.
(read-response): Fix a docstring.
* module/web/server.scm (extend-response): Include extend-response here,
but not exported.
* module/web/request.scm (read-request-body, write-request-body): Rename
from read-request-body/bytevector and
write-request-body/bytevector. Remove the /latin-1 variants, as they
were unused and a bad idea.
* module/web/response.scm (read-response-body, write-response-body):
Likewise.
* module/web/server/http.scm (http-read, http-write): Adapt to
request/response change.
* test-suite/tests/web-request.test:
* test-suite/tests/web-response.test: Update tests.
* 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/request.scm (read-response-body/latin-1):
* module/web/response.scm (read-response-body/latin-1): Avoid the
craziness of the read-delimited! interface and hand-roll our
own. Fixes errors if read-delimited returns #f or EOF.
* module/web/request.scm (read-request-body/latin-1):
* module/web/response.scm (read-response-body/latin-1): Detect short
reads instead of returning a full buffer with the last bits zeroed
out. (Before the make-string commit, they contained uninitialized
memory, which was a fairly serious error.)
* module/web/request.scm (<request>): Add `meta' field and accessor, for
metadata like the server IP, the client IP, CGI environment variables,
etc.
(build-request): Add meta kwarg.
(read-request): Add meta optional arg.
(write-request): Adapt.