Skip to content

Commit

Permalink
Fix request count check for BadHttpMethod
Browse files Browse the repository at this point in the history
This was incorrectly checking the first request ever instead of
the first request for the connection

#10055 (comment)
  • Loading branch information
bdraco committed Nov 30, 2024
1 parent 1fa237f commit cbb7cca
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions aiohttp/web_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,11 +713,7 @@ def handle_error(
Returns HTTP response with specific status code. Logs additional
information. It always closes current connection.
"""
if (
self._manager
and self._manager.requests_count == 1
and isinstance(exc, BadHttpMethod)
):
if self._request_count == 1 and isinstance(exc, BadHttpMethod):
# BadHttpMethod is common when a client sends non-HTTP
# or encrypted traffic to an HTTP port. This is expected
# to happen when connected to the public internet so we log
Expand Down

0 comments on commit cbb7cca

Please sign in to comment.