##// END OF EJS Templates
dummysmtpd: fix EOF handling on newer versions of OpenSSL...
Raphaël Gomès -
r52603:8fe7c0e1 default
parent child Browse files
Show More
@@ -31,8 +31,15 b' def log(msg):'
31 def mocksmtpserversession(conn, addr):
31 def mocksmtpserversession(conn, addr):
32 conn.send(b'220 smtp.example.com ESMTP\r\n')
32 conn.send(b'220 smtp.example.com ESMTP\r\n')
33
33
34 line = conn.recv(1024)
34 try:
35 # Newer versions of OpenSSL raise on EOF
36 line = conn.recv(1024)
37 except ssl.SSLError:
38 log('no hello: EOF\n')
39 return
40
35 if not line.lower().startswith(b'ehlo '):
41 if not line.lower().startswith(b'ehlo '):
42 # Older versions of OpenSSl don't raise
36 log('no hello: %s\n' % line)
43 log('no hello: %s\n' % line)
37 return
44 return
38
45
@@ -98,7 +98,7 b' Without certificates:'
98 $ wait_log "no hello:"
98 $ wait_log "no hello:"
99 $ cat ../log
99 $ cat ../log
100 connection from * (glob)
100 connection from * (glob)
101 no hello: b''
101 no hello: (b''|EOF) (re)
102 $ : > ../log
102 $ : > ../log
103
103
104 With global certificates:
104 With global certificates:
General Comments 0
You need to be logged in to leave comments. Login now