-
Notifications
You must be signed in to change notification settings - Fork 30k
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
http server respond with inappropriate default headers for HEAD
method
#28438
Comments
HEAD
methodHEAD
method
Hey @abbshr |
Fixes: #28438 PR-URL: #34231 Reviewed-By: James M Snell <[email protected]>
Fixes: #28438 PR-URL: #34231 Reviewed-By: James M Snell <[email protected]>
It seems this issue should be reopened because the bugfix commit was reverted. |
Hey! Can I work on this? |
To implement a HTTP keep alive mechanism, I use the
http.Agent({ keepAlive: true })
andhttp.request({ agent, method, host, port })
.Everything is ok when the method is
GET
orTRACE
and others, the agent reuse the TCP connection as I expect.But when changing the method to
HEAD
, the agent close the connection when server responded.From the response header, the only different is that: for
HEAD
method, there isn't aContent-Length: 0
orTransfer-Encoding: chunked
in the default header (butGET
has by default), so the HTTP parser think this connection should not be kept alive.But from the RFC, we can infer that if keep-alive was enabled, either
Content-Length: 0
orTransfer-Encoding: chunked
should be setted in response header, I think this should be a default behavior.The text was updated successfully, but these errors were encountered: