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

Call https website through proxy will cause error #1745

Closed
tangyouze opened this issue Mar 24, 2017 · 3 comments
Closed

Call https website through proxy will cause error #1745

tangyouze opened this issue Mar 24, 2017 · 3 comments
Labels

Comments

@tangyouze
Copy link

tangyouze commented Mar 24, 2017

Long story short

Call https website through http proxy will cause an internal error, however the result can be get.

This happens in version 2.0.0, aiohttp 1.3.5 works fine

Expected behaviour

No Warning is given

Actual behaviour

Some error message is printed out

Traceback (most recent call last):
  File "/Users/tyz/.pyenv/versions/3.5.0/lib/python3.5/site-packages/aiohttp/streams.py", line 158, in feed_eof
    cb()
  File "/Users/tyz/.pyenv/versions/3.5.0/lib/python3.5/site-packages/aiohttp/client_reqrep.py", line 567, in _response_eof
    if self._connection.protocol.upgraded:
AttributeError: 'NoneType' object has no attribute 'upgraded'

Steps to reproduce

service.qbtrade.org:4444 is blocked by firewall, and need to be replaced by some other proxy to run the example, however I cannot find some free proxy online

script.py

import asyncio
import aiohttp

import sys

print(sys.version)
print(aiohttp.__version__)


async def r():
    async with aiohttp.ClientSession() as t:
        # proxy needs to be replaced
        t = await t.get('https://httpbin.org/get', proxy='http://service.qbtrade.org:4444')
        print(await t.text())


asyncio.get_event_loop().run_until_complete(r())

result:

/Users/tyz/.pyenv/versions/3.5.0/bin/python /Users/tyz/Dropbox/qb/qb_playground/aiohttp-error.py
3.5.0 (default, Mar 11 2017, 09:13:49) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
2.0.2
Exception in eof callback
Traceback (most recent call last):
  File "/Users/tyz/.pyenv/versions/3.5.0/lib/python3.5/site-packages/aiohttp/streams.py", line 158, in feed_eof
    cb()
  File "/Users/tyz/.pyenv/versions/3.5.0/lib/python3.5/site-packages/aiohttp/client_reqrep.py", line 567, in _response_eof
    if self._connection.protocol.upgraded:
AttributeError: 'NoneType' object has no attribute 'upgraded'
{
  "args": {}, 
  "headers": {
    "Accept": "*/*", 
    "Accept-Encoding": "gzip, deflate", 
    "Connection": "close", 
    "Host": "httpbin.org", 
    "User-Agent": "Python/3.5 aiohttp/2.0.2"
  }, 
  "origin": "47.90.20.145", 
  "url": "https://httpbin.org/get"
}


Process finished with exit code 0

Your environment

@Noctem
Copy link

Noctem commented Mar 24, 2017

I'm getting the same error on Python 3.6.1.

@fafhrd91
Copy link
Member

should be fixed. I will release new version today

@lock
Copy link

lock bot commented Oct 28, 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 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 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

3 participants