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

Skip headers for Not Modified fs responses #205

Merged
merged 1 commit into from
Apr 15, 2019
Merged

Skip headers for Not Modified fs responses #205

merged 1 commit into from
Apr 15, 2019

Conversation

KamilaBorowska
Copy link
Contributor

According to RFC 7232, 304 Not Modified responses should not generate representation metadata other than the following fields: Cache-Control, Content-Location, Date, ETag, Expires, and Vary.

This avoids a warning from hyper when logging is enabled: "content-length value found, but empty body provided". While it is allowed to provide Content-Length for Not Modified responses it is unnecessary.

According to RFC 7232, 304 Not Modified responses should not generate
representation metadata other than the following fields: Cache-Control,
Content-Location, Date, ETag, Expires, and Vary.

This avoids a warning from hyper when logging is enabled:
"content-length value found, but empty body provided". While it is
allowed to provide Content-Length for Not Modified responses it is
unnecessary.
@KamilaBorowska
Copy link
Contributor Author

KamilaBorowska commented Apr 15, 2019

Depends on hyperium/hyper#1797 to be fixed, after actually testing this in practice. Providing Content-Length is unnecessary, but it's better than providing an outright wrong value.

Copy link
Owner

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this!

@seanmonstar seanmonstar merged commit 4a1c67c into seanmonstar:master Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants