Daniel,
> With the *connection* do you mean the underlying responder of the RequestContext?
With connection I mean the underlying HTTP (TCP) connection.
The `responder` of the `RequestContext` is your channel to the actor managing this connection.
> If so, i don't understand how this could be reused by another request.
HTTP connections can be (and are) generally reused for potentially many requests as establishing a new TCP connection is a somewhat costly process.
Once a connection is established a client could use it for 100s or even 1000s of independent requests.
> What are the cases where a connection will be reused. Is this somehow predictable?
In most cases connections are reused if
- the client and the server both speak HTTP/1.1 (rather than HTTP/1.0)
- neither the client nor the server set a `Connection: close` header
- the client has more requests that it wants to send to this server
What you can do in order to prevent connection reuse is to explicitly set a `Connection: close` response header.
This will cause spray-can to actively close the connection after the response has been sent out thereby preventing connection reuse very effectively.
If this forcing the client to establish a new connection for the next request is not an issue for your application
then this might be a viable alternative to setting the request timeout for every request as indicated in my last message.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/spray-user/2a400a31-97ce-4123-b246-b28464e93224%40googlegroups.com.