[Python-bugs-list] smtplib putcmd space+CRLF bug (PR#69)
guido@CNRI.Reston.VA.US
guido@CNRI.Reston.VA.US
Mon, 30 Aug 1999 11:14:38 -0400 (EDT)
> We think we have found a bug in "smtplib.py". In this library, every
> SMTP command has a space and CRLF appended to it. We have connected
> to the VPOP3 pop server, and it refuses to accept commands sent from
> smtplib.py. The problem appears to be because of the space between
> the DATA command and the CRLF.
This has already been fixed in the CVS tree (see
http://www.python.org/download/cvs.html). This is the patch:
Index: smtplib.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/smtplib.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -c -r1.17 -r1.18
*** smtplib.py 1999/04/21 16:52:20 1.17
--- smtplib.py 1999/06/09 15:13:10 1.18
***************
*** 231,237 ****
def putcmd(self, cmd, args=""):
"""Send a command to the server."""
! str = '%s %s%s' % (cmd, args, CRLF)
self.send(str)
def getreply(self):
--- 231,240 ----
def putcmd(self, cmd, args=""):
"""Send a command to the server."""
! if args == "":
! str = '%s%s' % (cmd, CRLF)
! else:
! str = '%s %s%s' % (cmd, args, CRLF)
self.send(str)
def getreply(self):
***************
*** 345,352 ****
"""SMTP 'mail' command -- begins mail xfer session."""
optionlist = ''
if options and self.does_esmtp:
! optionlist = string.join(options, ' ')
! self.putcmd("mail", "FROM:%s %s" % (quoteaddr(sender) ,optionlist))
return self.getreply()
def rcpt(self,recip,options=[]):
--- 348,355 ----
"""SMTP 'mail' command -- begins mail xfer session."""
optionlist = ''
if options and self.does_esmtp:
! optionlist = ' ' + string.join(options, ' ')
! self.putcmd("mail", "FROM:%s%s" % (quoteaddr(sender) ,optionlist))
return self.getreply()
def rcpt(self,recip,options=[]):
--Guido van Rossum (home page: http://www.python.org/~guido/)