Skip to content

Commit 540b3d0

Browse files
authored
gh-148508: Add another common pattern for iOS SSL failures to test_ssl (#150442)
Match also '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'.
1 parent f4bda4d commit 540b3d0

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
@@ -5698,17 +5698,24 @@ def non_linux_skip_if_other_okay_error(self, err):
56985698
return # Expect the full test setup to always work on Linux.
56995699
if (isinstance(err, (ConnectionResetError, ConnectionAbortedError)) or
57005700
(isinstance(err, OSError) and err.errno == errno.EINVAL) or
5701-
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I) or
5702-
re.search('record.layer.failure', str(getattr(err, "reason", "")), re.I)
5701+
re.search(
5702+
# Matches the following error messages:
5703+
# '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'
5704+
# '[SSL: RECORD_LAYER_FAILURE] record layer failure (_ssl.c:1109)'
5705+
# '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'
5706+
r'wrong.version.number|record.layer.failure|http.request',
5707+
str(getattr(err, "reason", "")),
5708+
re.IGNORECASE,
5709+
)
57035710
):
57045711
# On Windows the TCP RST leads to a ConnectionResetError
57055712
# (ECONNRESET) which Linux doesn't appear to surface to userspace.
57065713
# If wrap_socket() winds up on the "if connected:" path and doing
57075714
# the actual wrapping... we get an SSLError from OpenSSL. This is
57085715
# typically WRONG_VERSION_NUMBER. The same happens on iOS, but
5709-
# RECORD_LAYER_FAILURE is the error.
5716+
# RECORD_LAYER_FAILURE or HTTP_REQUEST is the error.
57105717
#
5711-
# While appropriate, neither is the scenario we're specifically
5718+
# While appropriate, these scenarios aren't what we're specifically
57125719
# trying to test. The way this test is written is known to work on
57135720
# Linux. We'll skip it anywhere else that it does not present as
57145721
# doing so.

Platforms/Apple/testbed/__main__.py

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

2727

0 commit comments

Comments
 (0)