8000 bpo-43921: Fix test_ssl.test_pha_required_nocert() (GH-26489) · python/cpython@320eaa7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 320eaa7

Browse files
authored
bpo-43921: Fix test_ssl.test_pha_required_nocert() (GH-26489)
Fix test_pha_required_nocert() of test_ssl: catch two more EOF cases (when the recv() method returns an empty string).
1 parent 8916633 commit 320eaa7

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Lib/test/test_ssl.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4460,11 +4460,18 @@ def msg_cb(conn, direction, version, content_type, msg_type, data):
44604460
'(certificate required|EOF occurred)'
44614461
):
44624462
# receive CertificateRequest
4463-
self.assertEqual(s.recv(1024), b'OK\n')
4463+
data = s.recv(1024)
4464+
if not data:
4465+
raise ssl.SSLError(1, "EOF occurred")
4466+
self.assertEqual(data, b'OK\n')
4467+
44644468
# send empty Certificate + Finish
44654469
s.write(b'HASCERT')
4470+
44664471
# receive alert
4467-
s.recv(1024)
4472+
data = s.recv(1024)
4473+
if not data:
4474+
raise ssl.SSLError(1, "EOF occurred")
44684475

44694476
def test_pha_optional(self):
44704477
if support.verbose:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix test_pha_required_nocert() of test_ssl: catch two more EOF cases (when
2+
the ``recv()`` method returns an empty string). Patch by Victor Stinner.

0 commit comments

Comments
 (0)
0