tests/dummysmtpd.py
changeset 51698 8f0b0df79039
parent 50732 b3a5af04da35
child 51700 7f0cb9ee0534
--- a/tests/dummysmtpd.py	Mon Jul 22 14:19:12 2024 +0200
+++ b/tests/dummysmtpd.py	Mon Jul 22 14:42:54 2024 +0200
@@ -31,8 +31,15 @@
 def mocksmtpserversession(conn, addr):
     conn.send(b'220 smtp.example.com ESMTP\r\n')
 
-    line = conn.recv(1024)
+    try:
+        # Newer versions of OpenSSL raise on EOF
+        line = conn.recv(1024)
+    except ssl.SSLError:
+        log('no hello: EOF\n')
+        return
+
     if not line.lower().startswith(b'ehlo '):
+        # Older versions of OpenSSl don't raise
         log('no hello: %s\n' % line)
         return