Skip to content

Commit 9e91460

Browse files
freakboy3742hugovk
authored andcommitted
[3.10] gh-148508: Add another common pattern for iOS SSL failures to test_ssl (GH-150442)
Match also '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'. (cherry picked from commit 540b3d0) Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
1 parent 22344e9 commit 9e91460

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

‎Lib/test/test_ssl.py‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4989,15 +4989,27 @@ def non_linux_skip_if_other_okay_error(self, err):
49894989
return # Expect the full test setup to always work on Linux.
49904990
if (isinstance(err, ConnectionResetError) or
49914991
(isinstance(err, OSError) and err.errno == errno.EINVAL) or
4992-
re.search('wrong.version.number', getattr(err, "reason", ""), re.I)):
4992+
re.search(
4993+
# Matches the following error messages:
4994+
# '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'
4995+
# '[SSL: RECORD_LAYER_FAILURE] record layer failure (_ssl.c:1109)'
4996+
# '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'
4997+
r'wrong.version.number|record.layer.failure|http.request',
4998+
str(getattr(err, "reason", "")),
4999+
re.IGNORECASE,
5000+
)
5001+
):
49935002
# On Windows the TCP RST leads to a ConnectionResetError
49945003
# (ECONNRESET) which Linux doesn't appear to surface to userspace.
49955004
# If wrap_socket() winds up on the "if connected:" path and doing
4996-
# the actual wrapping... we get an SSLError from OpenSSL. Typically
4997-
# WRONG_VERSION_NUMBER. While appropriate, neither is the scenario
4998-
# we're specifically trying to test. The way this test is written
4999-
# is known to work on Linux. We'll skip it anywhere else that it
5000-
# does not present as doing so.
5005+
# the actual wrapping... we get an SSLError from OpenSSL. This is
5006+
# typically WRONG_VERSION_NUMBER. The same happens on iOS, but
5007+
# RECORD_LAYER_FAILURE or HTTP_REQUEST is the error.
5008+
#
5009+
# While appropriate, these scenarios aren't what we're specifically
5010+
# trying to test. The way this test is written is known to work on
5011+
# Linux. We'll skip it anywhere else that it does not present as
5012+
# doing so.
50015013
try:
50025014
self.skipTest(f"Could not recreate conditions on {sys.platform}:"
50035015
f" {err=}")

0 commit comments

Comments
 (0)