* module/web/response.scm (response-must-not-include-body?): New
function.
* doc/ref/web.texi: Doc the function.
* module/web/server.scm (sanitize-response): Error if we have a body,
but the response type does not permit a body. If we are responding to
a HEAD request, silently drop the body.
* module/ice-9/boot-9.scm:
* module/ice-9/popen.scm:
* module/ice-9/pretty-print.scm:
* module/ice-9/r4rs.scm:
* module/rnrs/io/ports.scm:
* module/texinfo/string-utils.scm:
* module/web/http.scm:
* module/web/request.scm:
* module/web/response.scm:
* test-suite/vm/run-vm-tests.scm: Make the variable names in Scheme docstrings more
consistent. Replace a few instances of @var with @code when appropriate.
* 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/server.scm (read-client): Fix number of returned values in
the case in which there is an error reading the client.
(sanitize-response): Add a case to adapt the reponse to the request
version.
(handle-request): Sanitize the response within an error-handling
block.
(serve-one-client): Move sanitation out of here.
* module/web/server/http.scm (keep-alive?): A more proper detection on
whether we should support persistent connections.
* module/web/response.scm (adapt-response-version): New routine, to
adapt a response to a given version. Currently a stub.