Skip to content

Commit

Permalink
Fix #2752: Get rid of IndexError in aiohttp web server
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Feb 26, 2018
1 parent 6c92e8f commit 19f4f89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES/2752.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix ``IndexError`` in HTTP request handling by server.
14 changes: 8 additions & 6 deletions aiohttp/web_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,14 @@ def data_received(self, data):
500, exc))
self.close()
else:
for (msg, payload) in messages:
self._request_count += 1
self._messages.append((msg, payload))

if self._waiter:
self._waiter.set_result(None)
if messages:
# sometimes the parser returns no messages
for (msg, payload) in messages:
self._request_count += 1
self._messages.append((msg, payload))

if self._waiter is not None:
self._waiter.set_result(None)

self._upgraded = upgraded
if upgraded and tail:
Expand Down

0 comments on commit 19f4f89

Please sign in to comment.