Skip to content

[2.7] bpo-38330 Only set content-length when transfer-encoding is not present#16501

Closed
analoq wants to merge 1 commit into
python:2.7from
analoq:bpo-38330
Closed

[2.7] bpo-38330 Only set content-length when transfer-encoding is not present#16501
analoq wants to merge 1 commit into
python:2.7from
analoq:bpo-38330

Conversation

@analoq

@analoq analoq commented Sep 30, 2019

Copy link
Copy Markdown

RFC 7230 3.3.2 states "A sender MUST NOT send a Content-Length header field in any message that contains a Transfer-Encoding header field."

import httplib
http = httplib.HTTPSConnection('google.com')
http.set_debuglevel(1)
http.request("POST", '/', None, {'Content-Type': 'text/plain','Transfer-Encoding': 'chunked'})
send: 'POST / HTTP/1.1\r\nHost: google.com\r\nAccept-Encoding: identity\r\nContent-Length: 0\r\nTransfer-Encoding: chunked\r\nContent-Type: text/plain\r\n\r\n'

Includes both content-length and transfer-encoding. With this change:

import httplib
http = httplib.HTTPSConnection('google.com')
http.set_debuglevel(1)
http.request("POST", '/', None, {'Content-Type': 'text/plain','Transfer-Encoding': 'chunked'})
send: 'POST / HTTP/1.1\r\nHost: google.com\r\nAccept-Encoding: identity\r\nTransfer-Encoding: chunked\r\nContent-Type: text/plain\r\n\r\n'

Includes only transfer-encoding.

https://bugs.python.org/issue38330

@the-knights-who-say-ni

Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@analoq

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@csabella

Copy link
Copy Markdown
Contributor

Thank you the pull request, but Python 2 has now reached end of life.

@csabella csabella closed this Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants