Skip to content

do not send body content in reply to HEAD requests #124

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

Merged
merged 1 commit into from
Jun 30, 2020

Conversation

jbr
Copy link
Member

@jbr jbr commented Jun 29, 2020

Refs http-rs/tide#623, closes #125

HTTP HEAD responses MUST NOT include response body content, but async-h1 does not currently support the ability to omit the response body and still send a content-length header.

Attempts to close this at the http-types layer left async-h1 hanging indefinitely because async-h1 uses the same notion of body length for the header and the actual response body sending. In order to address this at the async-h1 level, the encoder needs to know the request method. No public API as of this commit is changed by this spec-conformance bugfix.

Copy link
Member

@yoshuawuyts yoshuawuyts left a comment

Choose a reason for hiding this comment

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

Looking great!

Comment on lines +183 to +185
// If we are responding to a HEAD request, we MUST NOT send
// body content
self.dispatch(State::End, cx, buf)
Copy link
Member

Choose a reason for hiding this comment

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

💯

@yoshuawuyts yoshuawuyts merged commit 24bd096 into http-rs:master Jun 30, 2020
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.

Body being sent for HEAD requests
2 participants