Skip to content

Commit

Permalink
Call https website through proxy will cause error #1745
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Mar 24, 2017
1 parent a666d7f commit decd925
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Expand Up @@ -2,6 +2,12 @@ Changes
=======


2.0.3 (2017-03-24)
------------------

- Call https website through proxy will cause error #1745


2.0.2 (2017-03-21)
------------------

Expand Down
6 changes: 4 additions & 2 deletions aiohttp/client_reqrep.py
Expand Up @@ -563,8 +563,10 @@ def _response_eof(self):
return

if self._connection is not None:
# websocket
if self._connection.protocol.upgraded:
# websocket, protocol could be None because
# connection could be detached
if (self._connection.protocol is not None and
self._connection.protocol.upgraded):
return

self._connection.release()
Expand Down
13 changes: 13 additions & 0 deletions tests/test_client_response.py
Expand Up @@ -172,6 +172,19 @@ def test_response_eof_upgraded(loop):
assert response._connection is conn


@asyncio.coroutine
def test_response_eof_after_connection_detach(loop):
response = ClientResponse('get', URL('http://def-cl-resp.org'))
response._post_init(loop)
response._closed = False
conn = response._connection = mock.Mock()
conn.protocol = None

response._response_eof()
assert conn.release.called
assert response._connection is None


@asyncio.coroutine
def test_text(loop):
response = ClientResponse('get', URL('http://def-cl-resp.org'))
Expand Down

2 comments on commit decd925

@Noctem
Copy link

@Noctem Noctem commented on decd925 Mar 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! How soon will this release be available on PyPI? I'm waiting for this to be readily available before pushing my codebase changes for 2.0.

@fafhrd91
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, forgot to update version

Please sign in to comment.