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

Skip to content
10000

Commit e5e93e6

Browse files
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). (cherry picked from commit 320eaa7) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 6563ea5 commit e5e93e6

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
@@ -4464,11 +4464,18 @@ def msg_cb(conn, direction, version, content_type, msg_type, data):
44644464
'(certificate required|EOF occurred)'
44654465
):
44664466
# receive CertificateRequest
4467-
self.assertEqual(s.recv(1024), b'OK\n')
4467+
data = s.recv(1024)
4468+
if not data:
4469+
raise ssl.SSLError(1, "EOF occurred")
4470+
self.assertEqual(data, b'OK\n')
4471+
44684472
# send empty Certificate + Finish
44694473
s.write(b'HASCERT')
4474+
44704475
# receive alert
4471-
s.recv(1024)
4476+
data = s.recv(1024)
4477+
if not data:
4478+
raise ssl.SSLError(1, "EOF occurred")
44724479

44734480
def test_pha_optional(self):
44744481
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