Skip to content
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

Hyper should skip automatic Content-Length header for HTTP 1xx responses #2215

Closed
psmit opened this issue Jun 3, 2020 · 0 comments · Fixed by #2216
Closed

Hyper should skip automatic Content-Length header for HTTP 1xx responses #2215

psmit opened this issue Jun 3, 2020 · 0 comments · Fixed by #2216
Labels
A-http1 Area: HTTP/1 specific. A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor.

Comments

@psmit
Copy link
Contributor

psmit commented Jun 3, 2020

Similar to issue #1797 hyper should not set a content-length header for a number of different scenario's. Quoting RFC 7230, section 3.3.2 6th paragraph:

A server MUST NOT send a Content-Length header field in any response
with a status code of 1xx (Informational) or 204 (No Content). A
server MUST NOT send a Content-Length header field in any 2xx
(Successful) response to a CONNECT request (Section 4.3.6 of
[RFC7231]).

At this moment the content-length header is set for 101 Switch Protocols responses. The resulting issue is that e.g. with a warp WebSocket server, a .Net client will drop the connection after 100 seconds: https://stackoverflow.com/a/44553521/85514 .

I believe the solution should be similar to [b342c38], and I'm willing to make a PR to do that. However, I'm not familiar enough with the code base to see if that would fix the problem / has any other implications.

psmit added a commit to psmit/hyper that referenced this issue Jun 3, 2020
psmit added a commit to psmit/hyper that referenced this issue Jun 3, 2020
psmit added a commit to psmit/hyper that referenced this issue Jun 3, 2020
@seanmonstar seanmonstar added A-http1 Area: HTTP/1 specific. A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor. labels Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-http1 Area: HTTP/1 specific. A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants