Skip to content

Making an HTTPS request with an HTTP proxy fails on Windows with asyncio's ProactorEventLoop #2245

@GDICommander

Description

@GDICommander

Hello,

I am using aiohttp 2.2.5 on Windows and on Python 3.6.2. I have discovered in #845 that HTTPS proxies are not supported.

When making a request on https://www.google.ca using a working proxy, http://my-proxy-example:12345 and changing the asyncio event loop to ProactorEventLoop, I have this error:

Traceback (most recent call last):
  File "f:\git\zeta_lt_agents\.tox\client\lib\site-packages\aiohttp\connector.py", line 378, in connect
    proto = yield from self._create_connection(req)
  File "f:\git\zeta_lt_agents\.tox\client\lib\site-packages\aiohttp\connector.py", line 685, in _create_connection
    _, proto = yield from self._create_proxy_connection(req)
  File "f:\git\zeta_lt_agents\.tox\client\lib\site-packages\aiohttp\connector.py", line 804, in _create_proxy_connection
    server_hostname=req.host)
  File "c:\python36\Lib\asyncio\base_events.py", line 803, in create_connection
    sock, protocol_factory, ssl, server_hostname)
  File "c:\python36\Lib\asyncio\base_events.py", line 829, in _create_connection_transport
    yield from waiter
  File "c:\python36\Lib\asyncio\proactor_events.py", line 202, in _loop_reading
    self._read_fut = self._loop._proactor.recv(self._sock, 4096)
  File "c:\python36\Lib\asyncio\windows_events.py", line 430, in recv
    self._register_with_iocp(conn)
  File "c:\python36\Lib\asyncio\windows_events.py", line 611, in _register_with_iocp
    _overlapped.CreateIoCompletionPort(obj.fileno(), self._iocp, 0, 0)
OSError: [WinError 87] The parameter is incorrect

This error does not occur when the default event loop on Windows is used (instead of ProactorEventLoop), but this cannot be done as I'm creating subprocesses in my application and this requires ProactorEventLoop.

Do you know what I need to do for HTTPS requests working with either an HTTP or HTTPS proxy or with ProactorEventLoop on Windows?

Have a good day!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions