aio-libs / aiohttp

Asynchronous HTTP client/server framework for asyncio and Python
https://docs.aiohttp.org
Other
15.16k stars 2.02k forks source link

aiohttp can't get https on centos5 #149

Closed Lupino closed 10 years ago

Lupino commented 10 years ago

when i request an https url it raise ValueError: check_hostname requires server_hostname, but it's not supported by your OpenSSL library

>>> import asyncio
>>> import aiohttp
>>> loop = asyncio.get_event_loop()
>>> res = loop.run_until_complete(aiohttp.request("get", "https://www.123rf.com"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/asyncio/base_events.py", line 208, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.4/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/lib/python3.4/asyncio/tasks.py", line 321, in _step
    result = next(coro)
  File "/usr/yupoo/app/huabot/src/aiohttp/aiohttp/client.py", line 108, in request
    conn = yield from connector.connect(req)
  File "/usr/yupoo/app/huabot/src/aiohttp/aiohttp/connector.py", line 155, in connect
    transport, proto = yield from self._create_connection(req)
  File "/usr/yupoo/app/huabot/src/aiohttp/aiohttp/connector.py", line 295, in _create_connection
    **kwargs))
  File "/usr/local/lib/python3.4/asyncio/base_events.py", line 437, in create_connection
    sock, protocol_factory, ssl, server_hostname)
  File "/usr/local/lib/python3.4/asyncio/base_events.py", line 449, in _create_connection_transport
    server_side=False, server_hostname=server_hostname)
  File "/usr/local/lib/python3.4/asyncio/selector_events.py", line 51, in _make_ssl_transport
    server_side, server_hostname, extra, server)
  File "/usr/local/lib/python3.4/asyncio/selector_events.py", line 588, in __init__
    sslsock = sslcontext.wrap_socket(rawsock, **wrap_kwargs)
  File "/usr/local/lib/python3.4/ssl.py", line 364, in wrap_socket
    _context=self)
  File "/usr/local/lib/python3.4/ssl.py", line 535, in __init__
    raise ValueError("check_hostname requires server_hostname, "
ValueError: check_hostname requires server_hostname, but it's not supported by your OpenSSL library
popravich commented 10 years ago

Can you 'get' it with requests library? What version of OpenSSL is installed?

Lupino commented 10 years ago

I test the requests it successful to get https://www.123rf.com

asvetlov commented 10 years ago

As I know CentOS 5 is not shipped with Python 3.4 so you probably build Python manually. And looks like your OpenSSL library is old enough, it doesn't support Server Name Indication (SNI) extension (OpenSSL 0.9.8+ required).

Anyway the problem lies into asyncio library, not aiohttp itself.

lock[bot] commented 5 years ago

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.