Skip to content

Empty host crashes aiohttp #510

@Insoleet

Description

@Insoleet

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions