Skip to content

Commit

Permalink
Fix handling of OpenSSL 3.2.0 new error message "record layer failure" (
Browse files Browse the repository at this point in the history
#3405)

Co-authored-by: Ruben Laguna <[email protected]>
Co-authored-by: Ruben Laguna <[email protected]>
Co-authored-by: Seth Michael Larson <[email protected]>
  • Loading branch information
4 people committed Jun 17, 2024
1 parent b600643 commit 29cfd02
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog/3268.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed handling of OpenSSL 3.2.0 new error message for misconfiguring an HTTP proxy as HTTPS.
4 changes: 3 additions & 1 deletion src/urllib3/connectionpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,9 @@ def _is_ssl_error_message_from_http_proxy(ssl_error):
# so we try to cover our bases here!
message = " ".join(re.split("[^a-z]", str(ssl_error).lower()))
return (
"wrong version number" in message or "unknown protocol" in message
"wrong version number" in message
or "unknown protocol" in message
or "record layer failure" in message
)

# Try to detect a common user error with proxies which is to
Expand Down
3 changes: 2 additions & 1 deletion test/with_dummyserver/test_socketlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,8 @@ def socket_handler(listener):
self._start_server(socket_handler)
with HTTPSConnectionPool(self.host, self.port, ca_certs=DEFAULT_CA) as pool:
with pytest.raises(
SSLError, match=r"(wrong version number|record overflow)"
SSLError,
match=r"(wrong version number|record overflow|record layer failure)",
):
pool.request("GET", "/", retries=False)

Expand Down

0 comments on commit 29cfd02

Please sign in to comment.