Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http client HEAD request failed to release #852

Closed
enzoliao opened this issue Apr 20, 2016 · 2 comments
Closed

Http client HEAD request failed to release #852

enzoliao opened this issue Apr 20, 2016 · 2 comments
Labels

Comments

@enzoliao
Copy link

My code is as followed:

import aiohttp
import asyncio

async def head(url):
    with aiohttp.ClientSession() as session:
        async with session.head(url) as ret:
            print(ret.status)

loop = asyncio.get_event_loop()
loop.run_until_complete(head("https://www.mongodb.org"))

What I got is as followed

200
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/base_events.py", line 337, in run_until_complete
    return future.result()
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "<stdin>", line 4, in head
  File "/usr/local/lib/python3.5/site-packages/aiohttp/client.py", line 557, in __aexit__
    yield from self._resp.release()
  File "/usr/local/lib/python3.5/site-packages/aiohttp/client_reqrep.py", line 668, in release
    chunk = yield from content.readany()
  File "/usr/local/lib/python3.5/site-packages/aiohttp/streams.py", line 485, in wrapper
    result = yield from func(self, *args, **kw)
  File "/usr/local/lib/python3.5/site-packages/aiohttp/streams.py", line 548, in readany
    return (yield from super().readany())
  File "/usr/local/lib/python3.5/site-packages/aiohttp/streams.py", line 278, in readany
    raise self._exception
  File "/usr/local/lib/python3.5/site-packages/aiohttp/parsers.py", line 189, in set_parser
    next(p)
  File "/usr/local/lib/python3.5/site-packages/aiohttp/protocol.py", line 318, in __call__
    out.feed_eof()
  File "/usr/local/lib/python3.5/site-packages/aiohttp/protocol.py", line 392, in feed_eof
    raise errors.ContentEncodingError('deflate')
aiohttp.errors.ContentEncodingError: 400, message='deflate'

When I change the url to "https://www.python.org", the error disappear.
I notice that there is a "Content-Encoding: gzip" in the response header when I request "https://www.mongodb.org", while the response of "https://www.python.org" doesn't have the same header. I guess this is what matters.
Could anybody give me some help on this? Thanks.

PS. I'm using Python 3.5.1, aiohttp 0.21.5.

@asvetlov
Copy link
Member

Fixed by #758
Will be available in aiohttp 0.22 release.

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants