http: do not add content-length: 0 to 101 responses on upgrade#10811
Merged
mattklein123 merged 1 commit intoApr 16, 2020
Merged
Conversation
Per RFC 7230 Section 3.3.2, 101 responses should not contain either a content-length or transfer-encoding. This change removes the forced addition of a Content-Length: 0 header in this case. Upstreams that return 101 or 204 responses with Content-Length or Transfer-Encoding continue to be forwarded downstream. Risk Level: low Testing: updated tests Docs Changes: n/a Release Notes: n/a Signed-off-by: Stephan Zuercher <zuercher@gmail.com>
alyssawilk
reviewed
Apr 16, 2020
Contributor
alyssawilk
left a comment
There was a problem hiding this comment.
LGTM, just one test nit
| {"upgrade", upgrade_type}, | ||
| {"content-length", "0"}}; | ||
| return Http::TestResponseHeaderMapImpl{ | ||
| {":status", "101"}, {"connection", "upgrade"}, {"upgrade", upgrade_type}}; |
Contributor
There was a problem hiding this comment.
As long as you're in here, I think this should be a 200.
Member
Author
There was a problem hiding this comment.
For http/1.1, it seems like it has to be 101. But maybe something different happens in h2?
From https://tools.ietf.org/html/rfc6455#section-4.2.2:
If the server chooses to accept the incoming connection, it MUST
reply with a valid HTTP response indicating the following.
- A Status-Line with a 101 response code as per RFC 2616
[RFC2616]. Such a response could look like "HTTP/1.1 101
Switching Protocols".
Member
Author
|
/retest |
|
🔨 rebuilding |
alyssawilk
approved these changes
Apr 16, 2020
Contributor
alyssawilk
left a comment
There was a problem hiding this comment.
Oh yes sorry, I've been so embedded in the CONNECT work I mixed my upgrades up. Never mind me.
zuercher
added a commit
to zuercher/envoy
that referenced
this pull request
Jun 5, 2020
Follow-on to envoyproxy#10811. The previous change would strip the transfer-encoding: chunked header if returned by an upstream during upgrade, but the http/1.1 codec adds the header back. RFC 7230, Section 3.3.1 requires that no such header appear in a 1xx response. Additional Description: Unfortunately in the first attempt I failed to realize that transfer-encoding is handled in the HTTP/1 codec. Adds checks and a flag in that codec to disable adding transfer-encoding: chunked to 1xx responses. Risk Level: low Testing: updated tests Docs Changes: n/a Release Notes: n/a Signed-off-by: Stephan Zuercher <zuercher@gmail.com>
zuercher
added a commit
that referenced
this pull request
Jun 10, 2020
…1458) Follow-on to #10811. The previous change would strip the transfer-encoding: chunked header if returned by an upstream during upgrade, but the http/1.1 codec adds the header back. RFC 7230, Section 3.3.1 requires that no such header appear in a 1xx or 204 response. Use runtime feature "envoy.reloadable_features.strict_1xx_and_204_response_headers" to disable. Risk Level: medium Testing: updated tests Docs Changes: n/a Release Notes: updated Signed-off-by: Stephan Zuercher <zuercher@gmail.com>
yashwant121
pushed a commit
to yashwant121/envoy
that referenced
this pull request
Jun 24, 2020
…voyproxy#11458) Follow-on to envoyproxy#10811. The previous change would strip the transfer-encoding: chunked header if returned by an upstream during upgrade, but the http/1.1 codec adds the header back. RFC 7230, Section 3.3.1 requires that no such header appear in a 1xx or 204 response. Use runtime feature "envoy.reloadable_features.strict_1xx_and_204_response_headers" to disable. Risk Level: medium Testing: updated tests Docs Changes: n/a Release Notes: updated Signed-off-by: Stephan Zuercher <zuercher@gmail.com> Signed-off-by: yashwant121 <yadavyashwant36@gmail.com>
songhu
pushed a commit
to songhu/envoy
that referenced
this pull request
Jun 25, 2020
…voyproxy#11458) Follow-on to envoyproxy#10811. The previous change would strip the transfer-encoding: chunked header if returned by an upstream during upgrade, but the http/1.1 codec adds the header back. RFC 7230, Section 3.3.1 requires that no such header appear in a 1xx or 204 response. Use runtime feature "envoy.reloadable_features.strict_1xx_and_204_response_headers" to disable. Risk Level: medium Testing: updated tests Docs Changes: n/a Release Notes: updated Signed-off-by: Stephan Zuercher <zuercher@gmail.com>
yashwant121
pushed a commit
to yashwant121/envoy
that referenced
this pull request
Jul 24, 2020
…voyproxy#11458) Follow-on to envoyproxy#10811. The previous change would strip the transfer-encoding: chunked header if returned by an upstream during upgrade, but the http/1.1 codec adds the header back. RFC 7230, Section 3.3.1 requires that no such header appear in a 1xx or 204 response. Use runtime feature "envoy.reloadable_features.strict_1xx_and_204_response_headers" to disable. Risk Level: medium Testing: updated tests Docs Changes: n/a Release Notes: updated Signed-off-by: Stephan Zuercher <zuercher@gmail.com> Signed-off-by: yashwant121 <yadavyashwant36@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per RFC 7230 Section 3.3.2, 101 responses should not contain
either a content-length or transfer-encoding. This change
removes the forced addition of a Content-Length: 0 header in
this case. Upstreams that return 101 or 204 responses with
Content-Length or Transfer-Encoding continue to be forwarded
downstream.
Risk Level: low
Testing: updated tests
Docs Changes: n/a
Release Notes: n/a
Signed-off-by: Stephan Zuercher zuercher@gmail.com