Issue1098618
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2005-01-08 20:24 by mdcowles, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (2) | |||
---|---|---|---|
msg23893 - (view) | Author: Matthew Cowles (mdcowles) | Date: 2005-01-08 20:24 | |
If you use socket.setdefaulttimeout() to set a socket timeout, and then do smtplib.starttls(), no data is read after TLS is started. Here's a session that's as you'd expect: >>> import smtplib >>> s=smtplib.SMTP("smtp.example.com") >>> s.set_debuglevel(1) >>> s.helo() send: 'helo mint-julep.mondoinfo.com\r\n' reply: '250 smtpout-1.example.net\r\n' reply: retcode (250); Msg: smtpout-1.example.net (250, 'smtpout-1.example.net') >>> s.starttls() send: 'STARTTLS\r\n' reply: '220 Ready to start TLS\r\n' reply: retcode (220); Msg: Ready to start TLS (220, 'Ready to start TLS') >>> s.ehlo() send: 'ehlo mint-julep.mondoinfo.com\r\n' reply: '250-smtpout-1.example.net\r\n' reply: '250-PIPELINING\r\n' reply: '250-SIZE 32768000\r\n' reply: '250-VRFY\r\n' reply: '250-ETRN\r\n' reply: '250-AUTH LOGIN PLAIN DIGEST-MD5\r\n' reply: '250-AUTH=LOGIN PLAIN DIGEST-MD5\r\n' reply: '250 8BITMIME\r\n' reply: retcode (250); Msg: smtpout-1.example.net PIPELINING SIZE 32768000 VRFY ETRN AUTH LOGIN PLAIN DIGEST-MD5 AUTH=LOGIN PLAIN DIGEST-MD5 8BITMIME (250, 'smtpout-1.example.net\nPIPELINING\nSIZE 32768000\nVRFY\nETRN\nAUTH LOGIN PLAIN DIGEST- MD5\nAUTH=LOGIN PLAIN DIGEST-MD5\n8BITMIME') >>> s.quit() send: 'quit\r\n' reply: '221 Bye\r\n' reply: retcode (221); Msg: Bye But if I set a socket timeout, I get this: >>> import socket >>> socket.setdefaulttimeout(30) >>> s=smtplib.SMTP("smtp.example.com") >>> s.set_debuglevel(1) >>> s.helo() send: 'helo mint-julep.mondoinfo.com\r\n' reply: '250 smtpout-1.example.net\r\n' reply: retcode (250); Msg: smtpout-1.example.net (250, 'smtpout-1.example.net') >>> s.starttls() send: 'STARTTLS\r\n' reply: '220 Ready to start TLS\r\n' reply: retcode (220); Msg: Ready to start TLS (220, 'Ready to start TLS') >>> s.ehlo() send: 'ehlo mint-julep.mondoinfo.com\r\n' ^CTraceback (most recent call last): File "<stdin>", line 1, in ? File "/Library/Frameworks/Python.framework/Versions/2.4/ lib/python2.4/smtplib.py", line 391, in ehlo (code,msg)=self.getreply() File "/Library/Frameworks/Python.framework/Versions/2.4/ lib/python2.4/smtplib.py", line 345, in getreply line = self.file.readline() File "/Library/Frameworks/Python.framework/Versions/2.4/ lib/python2.4/smtplib.py", line 160, in readline chr = self.sslobj.read(1) KeyboardInterrupt (I waited ten or fifteen seconds before typing the control-c.) If I set the socket timeout back to None, it works correctly: >>> socket.setdefaulttimeout(None) >>> s=smtplib.SMTP("smtp.example.com") >>> s.helo() (250, 'smtpout-2.example.net') >>> s.starttls() (220, 'Ready to start TLS') >>> s.ehlo() (250, 'smtpout-2.example.net\nPIPELINING\nSIZE 32768000\nVRFY\nETRN\nAUTH LOGIN PLAIN DIGEST- MD5\nAUTH=LOGIN PLAIN DIGEST-MD5\n8BITMIME') >>> s.quit() |
|||
msg23894 - (view) | Author: Georg Brandl (georg.brandl) * | Date: 2006-03-31 18:03 | |
Logged In: YES user_id=849994 Fixed with the commit of patch #1380952. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:09 | admin | set | github: 41411 |
2005-01-08 20:24:17 | mdcowles | create |