-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
ResponseEmitter should not remove Content-Type and Content-Length when body is empty due to HEAD being used #2924
Comments
In addition I think we should either expose some way for user to disable this behavior, get rid of it completely or check for some common headers like |
I'm not opposed to changing the behavior of the |
I believe the default should be not to touch these headers even if body is empty. Is there any specific reason why we would want to remove them even if user specifically set them? I think most web servers will try to guess Will not oppose some way to enable back the old behavior however I'd like to understand in what situations it might be welcome considering |
Are you going to create a pull request for this? |
I've made simple PR at #2925 which removes the check since I could not come with any situation where having ResponseEmitter automatically remove them would be desired behavior. |
ResponseEmitter's function
emit
performs check againstisResponseEmpty
and in such case removes headersContent-Type
andContent-Length
. This however has effect of removing these headers whenHEAD
request is sent (as the body in such case won't be set, it will be always empty). RFC2616 specifies:Additionally, some web servers might get wrong idea and try to insert
Content-Type
as detected, resulting in noContent-Length
header andContent-Type
being set as whatever web server defaults to (for nginx this would betext/html
on default configuration)The text was updated successfully, but these errors were encountered: