Skip to content

Commit 371cd81

Browse files
[3.12] pythongh-148508: Add another common pattern for iOS SSL failures to test_ssl (pythonGH-150442) (python#150699)
pythongh-148508: Add another common pattern for iOS SSL failures to test_ssl (pythonGH-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 8f56c1a commit 371cd81

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

‎Apple/testbed/__main__.py‎

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

2626

‎Lib/test/test_ssl.py‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4864,17 +4864,24 @@ def non_linux_skip_if_other_okay_error(self, err):
48644864
return # Expect the full test setup to always work on Linux.
48654865
if (isinstance(err, ConnectionResetError) or
48664866
(isinstance(err, OSError) and err.errno == errno.EINVAL) or
4867-
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I) or
4868-
re.search('record.layer.failure', str(getattr(err, "reason", "")), re.I)
4867+
re.search(
4868+
# Matches the following error messages:
4869+
# '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'
4870+
# '[SSL: RECORD_LAYER_FAILURE] record layer failure (_ssl.c:1109)'
4871+
# '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'
4872+
r'wrong.version.number|record.layer.failure|http.request',
4873+
str(getattr(err, "reason", "")),
4874+
re.IGNORECASE,
4875+
)
48694876
):
48704877
# On Windows the TCP RST leads to a ConnectionResetError
48714878
# (ECONNRESET) which Linux doesn't appear to surface to userspace.
48724879
# If wrap_socket() winds up on the "if connected:" path and doing
48734880
# the actual wrapping... we get an SSLError from OpenSSL. This is
48744881
# typically WRONG_VERSION_NUMBER. The same happens on iOS, but
4875-
# RECORD_LAYER_FAILURE is the error.
4882+
# RECORD_LAYER_FAILURE or HTTP_REQUEST is the error.
48764883
#
4877-
# While appropriate, neither is the scenario we're specifically
4884+
# While appropriate, these scenarios aren't what we're specifically
48784885
# trying to test. The way this test is written is known to work on
48794886
# Linux. We'll skip it anywhere else that it does not present as
48804887
# doing so.

0 commit comments

Comments
 (0)