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 304 responses #1797

Closed
KamilaBorowska opened this issue Apr 15, 2019 · 1 comment · Fixed by #1801
Closed

Hyper should skip automatic Content-Length header for HTTP 304 responses #1797

KamilaBorowska opened this issue Apr 15, 2019 · 1 comment · Fixed by #1801
Labels
A-http1 Area: HTTP/1 specific. C-feature Category: feature. This is adding a new feature. E-easy Effort: easy. A task that would be a great starting point for a new contributor.

Comments

@KamilaBorowska
Copy link

KamilaBorowska commented Apr 15, 2019

It's unnecessary, see RFC 7232.

Currently Hyper for empty bodies with Content-Length header unset automatically sets the value 0 which is incorrect for HTTP 304 responses, the correct values are either to not provide Content-Length (recommended by specification) or to provide Content-Length of a full response.

@seanmonstar seanmonstar added A-http1 Area: HTTP/1 specific. C-feature Category: feature. This is adding a new feature. labels Apr 22, 2019
@seanmonstar
Copy link
Member

This gets set here:

extend(dst, b"content-length: 0\r\n");

A check could be added there for cases when there should be no header added.

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. C-feature Category: feature. This is adding a new feature. 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