Skip to content

Commit 2b256cf

Browse files
[PR aio-libs#12238/24cb8c9c backport][3.14] Skip TLS-in-TLS warning when proxy is not HTTPS (aio-libs#12248)
**This is a backport of PR aio-libs#12238 as merged into master (24cb8c9).** Co-authored-by: wavebyrd <160968744+wavebyrd@users.noreply.github.com>
1 parent 5f50bac commit 2b256cf

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
@@ -1387,6 +1387,12 @@ def _warn_about_tls_in_tls(
13871387
if req.request_info.url.scheme != "https":
13881388
return
13891389

1390+
# TLS-in-TLS only applies when the proxy itself is HTTPS.
1391+
# When the proxy is HTTP, start_tls upgrades a plain TCP connection,
1392+
# which is standard TLS and works on all event loops and Python versions.
1393+
if req.proxy is None or req.proxy.scheme != "https":
1394+
return
1395+
13901396
# Check if uvloop is being used, which supports TLS in TLS,
13911397
# otherwise assume that asyncio's native transport is being used.
13921398
if type(underlying_transport).__module__.startswith("uvloop"):

0 commit comments

Comments
 (0)