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 320eaa7f42)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2021-06-02 16:48:40 -07:00 committed by GitHub
parent 6563ea5c60
commit e5e93e6145
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -4464,11 +4464,18 @@ class TestPostHandshakeAuth(unittest.TestCase):
'(certificate required|EOF occurred)'
):
# receive CertificateRequest
self.assertEqual(s.recv(1024), b'OK\n')
data = s.recv(1024)
if not data:
raise ssl.SSLError(1, "EOF occurred")
self.assertEqual(data, b'OK\n')
# send empty Certificate + Finish
s.write(b'HASCERT')
# receive alert
s.recv(1024)
data = s.recv(1024)
if not data:
raise ssl.SSLError(1, "EOF occurred")
def test_pha_optional(self):
if support.verbose: