homepage

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.

classification
Title: smtplib.SSLFakeFile hangs forever if "\n" is not encountered
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6, Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: facundobatista, giampaolo.rodola, gregory.p.smith, jafo, zanella
Priority: normal Keywords: patch

Created on 2008年02月19日 19:53 by giampaolo.rodola, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
smptlib.diff giampaolo.rodola, 2008年02月19日 19:53
Messages (3)
msg62569 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2008年02月19日 19:53
By looking through the smtplib module code I think I've found a
potential issue in the SSLFakeFile class code since there's a while loop
which is supposed to be stopped only when the "\n" character is encountered:
 def readline(self):
 str = ""
 chr = None
 while chr != "\n":
 chr = self.sslobj.read(1)
 str += chr
 return str
The patch in attachment just adds a break statement to prevent the while
loop to hang forever in case the "\n" character is never encountered.
msg62805 - (view) Author: Rafael Zanella (zanella) Date: 2008年02月23日 20:04
As of 2.6 the smtplib uses the ssl module, until 2.5 it uses _ssl, I
*think* that this issue would bring an Exception on 2.5 while on 2.6
would return a zero length string:
"""
def read(self, len=1024):
 """Read up to LEN bytes and return them.
 Return zero-length string on EOF."""
 return self._sslobj.read(len)
"""
wich would fulfill the "if not chr:"
msg64135 - (view) Author: Sean Reifschneider (jafo) * (Python committer) Date: 2008年03月20日 00:48
ssl.SSLSocket.read() says: Return zero-length string on EOF. So, I'm
going to apply this patch. Applied in rev 61656.
History
Date User Action Args
2022年04月11日 14:56:30adminsetgithub: 46396
2008年03月20日 00:52:18jafosetstatus: open -> closed
resolution: accepted
2008年03月20日 00:48:53jafosetpriority: normal
keywords: + patch
messages: + msg64135
nosy: + jafo
2008年02月23日 20:04:15zanellasetnosy: + zanella
messages: + msg62805
2008年02月19日 19:53:03giampaolo.rodolacreate

AltStyle によって変換されたページ (->オリジナル) /