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 auto-generation of Content-Type header. #507

Merged

Conversation

mpaolini
Copy link
Contributor

Content-Type header automatic generation did not honor
the documented skip_auto_headers param.

With this patch we correctly skip generation of this header
while documenting that it is not possible to do so for the
Content-Length header.

See Issue #379 for details.

Content-Type header automatic generation did not honor
the documented `skip_auto_headers` param.

With this patch we correctly skip generation of this header
while documenting that it is not possible to do so for the
`Content-Length` header.

See Issue aio-libs#379 for details.
@@ -290,7 +291,8 @@ def update_body_from_data(self, data):
if not self.chunked and isinstance(data, io.BytesIO):
# Not chunking if content-length can be determined
size = len(data.getbuffer())
self.headers[hdrs.CONTENT_LENGTH] = str(size)
if hdrs.CONTENT_LENGTH not in skip_auto_headers:
self.headers[hdrs.CONTENT_LENGTH] = str(size)
Copy link
Member

Choose a reason for hiding this comment

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

This one looks wrong. If we don't set content length here, we should fallback to chunked = True mode. Otherwise we'll violate the spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoa Yep you're right, I'll fix this right away

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok fixed

Even when the caller asked to skip it!
@mpaolini
Copy link
Contributor Author

also fixes #457

asvetlov added a commit that referenced this pull request Sep 14, 2015
…ader

Skip auto-generation of Content-Type header.
@asvetlov asvetlov merged commit dcf843e into aio-libs:master Sep 14, 2015
@asvetlov
Copy link
Member

Merged. Thanks.

@lock
Copy link

lock bot commented Oct 30, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 30, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants