[racket] Parameters and servlets

From: Greg Hendershott (greghendershott at gmail.com)
Date: Wed Jan 22 12:27:47 EST 2014

No. HTTP 1.1 (as opposed to HTTP 1.0) says that one TCP connection may
be used to make multiple requests. This is faster, since there's some
overhead for each connection. For example a web page might consist of
many small items from the same server; one connection can be used to
request all of them.

Jay is saying that web-server supports this aspect of HTTP 1.1, and,
that it uses one thread per _connection_ (not per request). As a
result, it's not necessarily the case that there will be a 1:1:1
relationship between connections and requests and threads. One
connection and its thread might service many requests. As a result,
even though Racket parameters are indeed per-thread, they won't
necessarily be per-HTTP-request.

Now, HTTP 1.1 allows clients and servers to say "close the connection
after this request" by supplying a "Connection: close" request or
response header. If you supply such a response header, I think Racket
web-server will close the connection (and kill the thread).  So you
could try that as a quick experiment.

However it might be preferable to come up with some other way to do this.

> I am not sure to understand you about HTTP request.
>
> I will explicit what i think is done (in the current implementation):
>
> - Initialisation of a tcp connection
> - Client sent an HTTP request
> - Server create a thread (in the actual implementation) do the work and return a response
> - end of tcp connection
>
> Am i right?

Posted on the users mailing list.