Skip to content

Commit 24cb8c9

Browse files
authored
Skip TLS-in-TLS warning when proxy is not HTTPS (aio-libs#12238)
1 parent 66c7205 commit 24cb8c9

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

CHANGES/10683.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed misleading TLS-in-TLS warning being emitted when sending HTTPS requests through an HTTP proxy. The warning now only fires when the proxy itself uses HTTPS, which is the only case where TLS-in-TLS actually applies -- by :user:`wavebyrd`.

aiohttp/connector.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,12 @@ def _warn_about_tls_in_tls(
12751275
if req.url.scheme != "https":
12761276
return
12771277

1278+
# TLS-in-TLS only applies when the proxy itself is HTTPS.
1279+
# When the proxy is HTTP, start_tls upgrades a plain TCP connection,
1280+
# which is standard TLS and works on all event loops and Python versions.
1281+
if req.proxy is None or req.proxy.scheme != "https":
1282+
return
1283+
12781284
# Check if uvloop is being used, which supports TLS in TLS,
12791285
# otherwise assume that asyncio's native transport is being used.
12801286
if type(underlying_transport).__module__.startswith("uvloop"):

0 commit comments

Comments
 (0)