Skip to content

Commit 29cfd02

Browse files
illia-vecerulmrubelagusethmlarson
authored
Fix handling of OpenSSL 3.2.0 new error message "record layer failure" (#3405)
Co-authored-by: Ruben Laguna <[email protected]> Co-authored-by: Ruben Laguna <[email protected]> Co-authored-by: Seth Michael Larson <[email protected]>
1 parent b600643 commit 29cfd02

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

changelog/3268.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed handling of OpenSSL 3.2.0 new error message for misconfiguring an HTTP proxy as HTTPS.

src/urllib3/connectionpool.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,9 @@ def _is_ssl_error_message_from_http_proxy(ssl_error):
768768
# so we try to cover our bases here!
769769
message = " ".join(re.split("[^a-z]", str(ssl_error).lower()))
770770
return (
771-
"wrong version number" in message or "unknown protocol" in message
771+
"wrong version number" in message
772+
or "unknown protocol" in message
773+
or "record layer failure" in message
772774
)
773775

774776
# Try to detect a common user error with proxies which is to

test/with_dummyserver/test_socketlevel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,8 @@ def socket_handler(listener):
12231223
self._start_server(socket_handler)
12241224
with HTTPSConnectionPool(self.host, self.port, ca_certs=DEFAULT_CA) as pool:
12251225
with pytest.raises(
1226-
SSLError, match=r"(wrong version number|record overflow)"
1226+
SSLError,
1227+
match=r"(wrong version number|record overflow|record layer failure)",
12271228
):
12281229
pool.request("GET", "/", retries=False)
12291230

0 commit comments

Comments
 (0)