You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Windows 10 and 11, if a system-wide proxy is configured in the OS settings, Requests won't load HTTPS websites.
Instead of the regular CONNECT header, Requests sends TLS request to the proxy server (ip and port). The TLS ClientHello does not have Server Name Indication field, that's why I assume that Requests misinterprets the proxy as a Secure Web Proxy (a regular proxy with TLS encapsulation on top), which Windows does not support.
Expected Result
If system-wide proxy is configured in Windows, Requests sends CONNECT header to the proxy server when HTTPS website is requested.
Actual Result
If system-wide proxy is configured in Windows, Requests sends TLS request to the proxy address when HTTPS website is requested.
Reproduction Steps
Configure system-wide proxy on Windows
importrequestsrequests.get("https://w3.org/")
Result:
My proxy does not respond to the packets it does not understand, and I receive the following error: HTTPSConnectionPool(host='w3.org, port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1114: The handshake operation timed out')))
This bug has existed for a very long time (since Python 2.0.1 if not earlier), but it was exposed recently when urllib3 added support for HTTPS-in-HTTPS proxies in version 1.26. Before that, an https prefix on the HTTPS proxy url was silently treated as http, accidentally resulting in the correct behavior.
Fixed in Python 3.10.5, all the previous versions are still affected.
On Windows 10 and 11, if a system-wide proxy is configured in the OS settings, Requests won't load HTTPS websites.
Instead of the regular CONNECT header, Requests sends TLS request to the proxy server (ip and port). The TLS ClientHello does not have Server Name Indication field, that's why I assume that Requests misinterprets the proxy as a Secure Web Proxy (a regular proxy with TLS encapsulation on top), which Windows does not support.
Expected Result
If system-wide proxy is configured in Windows, Requests sends CONNECT header to the proxy server when HTTPS website is requested.
Actual Result
If system-wide proxy is configured in Windows, Requests sends TLS request to the proxy address when HTTPS website is requested.
Reproduction Steps
Result:
My proxy does not respond to the packets it does not understand, and I receive the following error:
HTTPSConnectionPool(host='w3.org, port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1114: The handshake operation timed out')))
System Information
The text was updated successfully, but these errors were encountered: