Open iandresolares opened 2 years ago
This error happens whenever there is a request with a invalid HTTP verb. Any production server will receive many invalid requests and they shouldn't all throw errors. This buries real errors in the code. Such issues should be logged separately.
I think this is probably resolved by one of our parser fixes in recent releases. Please retest and report back.
Describe the bug
Hi, I have setup a webserver which handles some POST requests. This works fine, however when the server is running for some hours I start to see some errors handling requests which were not supposed to happen:
Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/aiohttp/web_protocol.py", line 314, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
This happens a few times every few hours and I am the only one doing requests to the webserver right now so I have control of them. I have read some issues having similar problems but I still can't find a solution. What are these requests which fail? It doesn't make my system fail or anything but it is very annoying to try to find something in the logs and just see a bunch of these exceptions and I haven't been able to wrap it in a Try Except block. Where should I place this try except block if that would be the solution?
To Reproduce
async def create_webserver(): runner = web.AppRunner(app) await runner.setup() site = web.TCPSite(runner) await site.start()
await create_webserver()
Python Version
aiohttp Version
multidict Version
yarl Version
OS
Ubuntu 20.04
Related component
Server
Additional context
No response
Code of Conduct