Skip to content

Commit

Permalink
Handle request body read timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Apr 3, 2016
1 parent c59d3a5 commit 3bb5ee1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cockatiel/handlers.py
Expand Up @@ -61,6 +61,11 @@ def put_file(request: web.Request):

with tempfile.SpooledTemporaryFile(max_size=1024 * 1024) as tmpfile:
for chunk in request_chunks(request):
if isinstance(chunk, asyncio.Future):
try:
chunk = yield from asyncio.wait_for(chunk, timeout=60)
except asyncio.TimeoutError:
raise web.HTTPRequestTimeout()
checksum.update(chunk)
tmpfile.write(chunk)

Expand Down

0 comments on commit 3bb5ee1

Please sign in to comment.