* module/web/server/http.scm (bad-request, http-read): If an exception
is raised while reading a response, write out a 400 Bad Request
response before closing the port.
* 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/server/http.scm (http-read): Don't play the setvbuf dance,
it was throwing away buffered input. Instead just call setvbuf once
before doing any reads or writes.
* module/web/server/http.scm (http-read): No need for a
call-with-error-handling block here, as the read impl is itself within
an error-handling block.
* module/web/server/http.scm (http-open): Allow up to 128 pending
connections -- the default value for somaxconn on a number of
machines. This is from the HOP paper.
(http-read): Set the send buffer to 12 KB, also from the HOP paper.
* module/web/server/http.scm (http-read): Rewrite to iterate down the
pollset, so the vector shuffles touch less memory and the end
condition of the loop is clearer.
* module/web/server.scm: Rewrite to remove the extra "keep-alive"
parameter. Instead, since the server is an essentially stateful
object, have clients that want to do keep-alive manage that set as
part of the server state. Also avoids imposing a particular data
structure on the server implementation.
* module/web/server/http.scm: Adapt to the new server interface. Also,
use a poll set instead of select and lists. Makes handling 1000
clients at a time much more possible.
* module/web/server/http.scm (http-read, http-write): Line-buffer the
port while we're reading the request, and block-buffer it otherwise
Use the default block size.
* 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.
* module/web/server.scm: New generic web server module, with support for
different backends. An HTTP-over-TCP backend is the only one included
with Guile, though one can imagine FastCGI, mod-lisp, mongrel2/0mq etc
backends as well.
* module/web/server/http.scm: The aforementioned HTTP backend.