Skip to content

SSL Errors are not caught by proxy connector #2408

Closed
@Insoleet

Description

Long story short

I'm running an application which can connects to many heterogeneous systems. Sometimes, SSL is badly done and verify fails.

When using a proxy connector, the exception is not catched by aiohttp. So my application, which is only waiting for standard aiohttp exception, fails to catch this one.

Expected behaviour

I expected the connector to catch this error so that it can throw an aiottp exception ClientSSLError, like the standard connector : https://github.com/aio-libs/aiohttp/blob/master/aiohttp/connector.py#L822

Actual behaviour

future: <Task finished coro=<NodeConnector.connect_peers() done, defined at sakia\data\connectors\node.py:278> exception=SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)')>

    ----
    Traceback (most recent call last):

  File "asyncio\tasks.py", line 242, in _step

  File "sakia\data\connectors\node.py", line 289, in connect_peers

  File "site-packages\aiohttp\client.py", line 692, in __aenter__

  File "site-packages\aiohttp\client.py", line 457, in _ws_connect

  File "site-packages\aiohttp\helpers.py", line 99, in __iter__

  File "site-packages\aiohttp\client.py", line 269, in _request

  File "site-packages\aiohttp\connector.py", line 392, in connect

  File "site-packages\aiohttp\connector.py", line 735, in _create_connection

  File "site-packages\aiohttp\connector.py", line 898, in _create_proxy_connection

  File "asyncio\base_events.py", line 802, in create_connection

  File "asyncio\base_events.py", line 828, in _create_connection_transport

  File "asyncio\futures.py", line 381, in __iter__

  File "asyncio\tasks.py", line 310, in _wakeup

  File "asyncio\futures.py", line 294, in result

  File "asyncio\sslproto.py", line 502, in data_received

  File "asyncio\sslproto.py", line 201, in feed_ssldata

  File "ssl.py", line 641, in do_handshake

ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)

Steps to reproduce

Connect to a self-signed HTTPS website, throught a proxy.

Your environment

Windows 64 bits, python 3.5.

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