aiohttp.http_exceptions.BadStatusLine caused by extra CRLF after POST data #1792
Description
Long story short
Some http clients may send extra CRLF after POST data. These extra two bytes are not accounted in Content-Length. It will cause..
$ python main.py
======== Running on http://127.0.0.1:8000 ========
(Press CTRL+C to quit)
Error handling request
Traceback (most recent call last):
File "/home/zarnovic/venv/aiotest/lib/python3.5/site-packages/aiohttp/web_protocol.py", line 276, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "/home/zarnovic/venv/aiotest/lib/python3.5/site-packages/aiohttp/http_parser.py", line 115, in feed_data
msg = self.parse_message(self._lines)
File "/home/zarnovic/venv/aiotest/lib/python3.5/site-packages/aiohttp/http_parser.py", line 331, in parse_message
raise BadStatusLine(line) from None
aiohttp.http_exceptions.BadStatusLine: ''
We have noticed this problem after upgrade to aiohttp 2.x with check_http client (part of Nagios/Icinga).
Bisect shows that this commit 51baae6 broke it. Seems like all 2.x are affected.
I'm inclined to believe that this is a client's problem. Which, I have reported nagios-plugins/nagios-plugins#266. However, this behavior was "broken" by a change in aiohttp, so I'm reporting it also here, for people to find it. Also, it may be a case that aiohttp is too strict in parsing and there may be other clients behaving like check_http.
Feel free to close it, if you believe it is not aiohttp's problem.
Expected behaviour
See linked ticket.
Actual behaviour
See linked ticket.
Steps to reproduce
See linked ticket.
Your environment
aiohttp (2.0.5)
$ /usr/lib64/nagios/plugins/check_http --version
check_http v2.0.3 (nagios-plugins 2.0.3)
There is no proxy/nat/firewall between them. It is reproducible on localhost.