MUST NOT send Content-Length/Transfer-Encoding for 1xx or 204 #4901
Labels
bug
reproducer: present
This PR or issue contains code, which reproduce the problem described or clearly understandable STR
🐞 Describe the bug
According to RFC7230 (https://tools.ietf.org/html/rfc7230#section-3.3.2 and https://tools.ietf.org/html/rfc7230#section-3.3.1) a server must not send neither the
Content-Length
nor theTransfer-Encoding
header field for 1xx and 204 responses.Note that in practice clients and proxies might get into trouble when receiving such a response. E.g. with a nginx reverse proxy this behaviour leads to the following error:
upstream prematurely closed connection ...
💡 To Reproduce
Exemplary for
web.Response
:💡 Expected behavior
Do not ship the headers mentioned above.
📋 Your version of the Python
📋 Your version of the aiohttp/yarl/multidict distributions
The
aiohttp
version should agree with the currentmaster
.The text was updated successfully, but these errors were encountered: