Skip to content

Commit 542e01c

Browse files
[3.13] gh-148508: Add another common pattern for iOS SSL failures to test_ssl (GH-150442) (#150699)
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 92a1c8b commit 542e01c

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

Lib/test/test_ssl.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5320,17 +5320,24 @@ def non_linux_skip_if_other_okay_error(self, err):
53205320
return # Expect the full test setup to always work on Linux.
53215321
if (isinstance(err, ConnectionResetError) or
53225322
(isinstance(err, OSError) and err.errno == errno.EINVAL) or
5323-
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I) or
5324-
re.search('record.layer.failure', str(getattr(err, "reason", "")), re.I)
5323+
re.search(
5324+
# Matches the following error messages:
5325+
# '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'
5326+
# '[SSL: RECORD_LAYER_FAILURE] record layer failure (_ssl.c:1109)'
5327+
# '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'
5328+
r'wrong.version.number|record.layer.failure|http.request',
5329+
str(getattr(err, "reason", "")),
5330+
re.IGNORECASE,
5331+
)
53255332
):
53265333
# On Windows the TCP RST leads to a ConnectionResetError
53275334
# (ECONNRESET) which Linux doesn't appear to surface to userspace.
53285335
# If wrap_socket() winds up on the "if connected:" path and doing
53295336
# the actual wrapping... we get an SSLError from OpenSSL. This is
53305337
# typically WRONG_VERSION_NUMBER. The same happens on iOS, but
5331-
# RECORD_LAYER_FAILURE is the error.
5338+
# RECORD_LAYER_FAILURE or HTTP_REQUEST is the error.
53325339
#
5333-
# While appropriate, neither is the scenario we're specifically
5340+
# While appropriate, these scenarios aren't what we're specifically
53345341
# trying to test. The way this test is written is known to work on
53355342
# Linux. We'll skip it anywhere else that it does not present as
53365343
# doing so.

iOS/testbed/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
LOG_PREFIX_REGEX = re.compile(
1818
r"^\d{4}-\d{2}-\d{2}" # YYYY-MM-DD
1919
r"\s+\d+:\d{2}:\d{2}\.\d+\+\d{4}" # HH:MM:SS.ssssss+ZZZZ
20-
r"\s+iOSTestbed\[\d+:\w+\]" # Process/thread ID
20+
r"\s+iOSTestbed\[\d+:\w+\] " # Process/thread ID
2121
)
2222

2323

0 commit comments

Comments
 (0)