Closed Green360 closed 4 months ago
The "Transfer-Encoding" header is ignored by the requests library.
Expected Result
I expect a request in line with the following core data:
POST /test.php HTTP/1.1 Host: [replaced] Transfer-Encoding: chunked Content-Type: application/x-www-form-urlencoded
7 param=2
Actual Result
I obtain a request without the "Transfer-Encoding" header despite it being explicitly set:
POST /test.php HTTP/1.1 Host: [replaced] User-Agent: python-requests/2.28.1 Accept-Encoding: gzip, deflate, br Accept: / Connection: close Content-Length: 12
7 param=2
Reproduction Steps
import requests url = 'http://[replaced]/test.php' def data_chunks(): yield b'7\r\n' yield b'param=2\r\n' response = requests.post(url,data=data_chunks(), headers={"Transfer-Encoding":"chunked", "Content-Type":"application/x-www-form-urlencoded"}, proxies={"http":"http://127.0.0.1:8080"})
System Information
$ python -m requests.help
{ "chardet": { "version": "5.1.0" }, "charset_normalizer": { "version": "3.0.1" }, "cryptography": { "version": "38.0.4" }, "idna": { "version": "3.3" }, "implementation": { "name": "CPython", "version": "3.11.2" }, "platform": { "release": "6.5.0-13parrot1-amd64", "system": "Linux" }, "pyOpenSSL": { "openssl_version": "30000080", "version": "23.0.0" }, "requests": { "version": "2.28.1" }, "system_ssl": { "version": "300000d0" }, "urllib3": { "version": "1.26.12" }, "using_charset_normalizer": false, "using_pyopenssl": true }
The version you are using is outdated, please upgrade to the latest version:
This will solve the issue.
The "Transfer-Encoding" header is ignored by the requests library.
Expected Result
I expect a request in line with the following core data:
Actual Result
I obtain a request without the "Transfer-Encoding" header despite it being explicitly set:
Reproduction Steps
System Information