Skip to content

Commit

Permalink
Fixed None timeout support #1720
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Mar 16, 2017
1 parent 0c4efcf commit d0c7307
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
8 changes: 7 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
CHANGES
=======

1.3.4 (2017-03-14)
1.3.5 (2017-03-16)
------------------

- Fixed None timeout support #1720


1.3.4 (2017-03-15)
------------------

- Revert timeout handling in client request
Expand Down
10 changes: 6 additions & 4 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,12 @@ def _request(self, method, url, *,

break

if resp.connection is not None:
resp.connection.add_callback(handle.cancel)
else:
handle.cancel()
if handle is not None:
if resp.connection is not None:
resp.connection.add_callback(handle.cancel)
else:
handle.cancel()

resp._history = tuple(history)
return resp

Expand Down
16 changes: 16 additions & 0 deletions tests/test_client_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,22 @@ def handler(request):
yield from resp.read()


@asyncio.coroutine
def test_timeout_none(loop, test_client, mocker):
@asyncio.coroutine
def handler(request):
resp = web.StreamResponse()
yield from resp.prepare(request)
return resp

app = web.Application(loop=loop)
app.router.add_route('GET', '/', handler)
client = yield from test_client(app)

resp = yield from client.get('/', timeout=None)
assert resp.status == 200


@asyncio.coroutine
def test_readline_error_on_conn_close(loop, test_client):

Expand Down

0 comments on commit d0c7307

Please sign in to comment.