Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Strip Content-Length header when Transfer-Encoding header is set on response #1164

Closed
halter73 opened this issue Oct 12, 2016 · 3 comments
Closed

Comments

@halter73
Copy link
Member

I seems the HTTP the spec suggests removing the content-length header when a transfer-encoding header is set.

If a message is received with both a Transfer-Encoding and a
Content-Length header field, the Transfer-Encoding overrides the
Content-Length. Such a message might indicate an attempt to
perform request smuggling (Section 9.5) or response splitting
(Section 9.4) and ought to be handled as an error. A sender MUST
remove the received Content-Length field prior to forwarding such
a message downstream.
https://tools.ietf.org/html/rfc7230#section-3.3.3

#1163 (comment)

Maybe this is just intended for proxies, but it makes sense not to send both headers. It might even be a good idea to throw when an app attempts to send both, but that would be breaking.

@cesarblum
Copy link
Contributor

I was thinking about this again. The thing that bothers me a little about not implementing this change is that the spec says MUST. I agree it seems to be referring to proxies (though it's not 100% clear on this), I don't see why an endpoint shouldn't do the same. We should at least log a warning when sending a response containing both headers.

Thoughts?

@muratg muratg reopened this Nov 3, 2016
@muratg
Copy link
Contributor

muratg commented Nov 3, 2016

@CesarBS I closed this based on seeing you removing the assignment. Happy to talk about this again.

@muratg
Copy link
Contributor

muratg commented Nov 21, 2016

In case someone's broken, we can consider bringing this back.

@muratg muratg closed this as completed Nov 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants