Skip to content
New issue

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

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

Already on GitHub? # to your account

Empty host crashes aiohttp #510

Closed
Insoleet opened this issue Sep 16, 2015 · 9 comments
Closed

Empty host crashes aiohttp #510

Insoleet opened this issue Sep 16, 2015 · 9 comments
Labels

Comments

@Insoleet
Copy link
Contributor

Hello,

The following line produce a crash :

        response = yield from aiohttp.get("http://:8001/crash")

The stack trace is the following :

  File "/usr/lib/python3.4/asyncio/tasks.py", line 238, in _step
    result = next(coro)
  File "/usr/lib/python3.4/site-packages/aiohttp/client.py", line 474, in get
    ret = yield from request(hdrs.METH_GET, url, **kwargs)
  File "/usr/lib/python3.4/site-packages/aiohttp/client.py", line 466, in request
    read_until_eof=read_until_eof)
  File "/usr/lib/python3.4/site-packages/aiohttp/client.py", line 129, in request
    loop=self._loop, response_class=self._response_class)
  File "/usr/lib/python3.4/site-packages/aiohttp/client_reqrep.py", line 77, in __init__
    self.update_host(url)
  File "/usr/lib/python3.4/site-packages/aiohttp/client_reqrep.py", line 118, in update_host
    host = host.encode('idna').decode('utf-8')
AttributeError: 'NoneType' object has no attribute 'encode'
@kxepal
Copy link
Member

kxepal commented Sep 17, 2015

What did you expect? (:

@Insoleet
Copy link
Contributor Author

Well shouldn't it raise a more comprehensive error ?
Like this one : https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/client_reqrep.py#L111

@kxepal
Copy link
Member

kxepal commented Sep 17, 2015

Should be easy to fix. Want to submit PR?

@Insoleet
Copy link
Contributor Author

Ok I'll do. Shoud l write a unit test for this bug ?

@kxepal
Copy link
Member

kxepal commented Sep 17, 2015

Yes. We don't want to have your changes accidentally get broken in future, do we?

@Insoleet
Copy link
Contributor Author

Sure ;) I'll try to work on it tonight.

@kxepal
Copy link
Member

kxepal commented Sep 17, 2015

Thanks! (:

@asvetlov
Copy link
Member

Fixed by #511

@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
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants