-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Keep-Alive. #2
Comments
This can be implemented using Deferrable Connections with EventMachine. See Issue #3. |
Related note Rack::Handler::HTTP uses Rack::RewindableInput for request body:
which calls Stream#read:
which reads from socket until provided limit or EOF reached:
When client uses Keep-Alive, it doesn't close socket after sending request body. Thus, Stream#read hangs, because request body is often smaller than 4096 bytes and there is no EOF. A quick workaround is to limit maximum length that can be read from stream with
With this fix, net-http-server still ignores Keep-Alive and closes socket, but at least it doesn't hang, which allows to use it with modern clients. Though, I didn't test this workaround very much, it probably has some other pitfalls. Note that Keep-Alive is default in HTTP/1.1 (i.e. it should be used even if Keep-Alive header is omitted), and HTTP/1.1 is default in Golang http client, so net-http-server usually hangs when handling requests from clients written in Go. |
Also, it seems that |
The Server Daemon does not support re-using the socket when the
Keep-Alive
header is specified.The text was updated successfully, but these errors were encountered: