[Python-checkins] CVS: python/dist/src/Lib smtplib.py,1.27,1.28
Fred L. Drake
python-dev@python.org
Wed, 16 Aug 2000 07:26:25 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv28931/Lib
Modified Files:
smtplib.py
Log Message:
Use socket.getfqdn() instead of defining make_fqdn().
Index: smtplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/smtplib.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** smtplib.py 2000/08/15 19:30:36 1.27
--- smtplib.py 2000/08/16 14:26:22 1.28
***************
*** 134,163 ****
re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data))
- def make_fqdn(name = ''):
- """Get fully qualified domain name from name.
- An empty argument is interpreted as meaning the local host.
-
- First the hostname returned by socket.gethostbyaddr()
- is checked, then possibly existing aliases. In case
- no FQDN is available, hostname is returned.
- """
- name = string.strip(name)
- if len(name) == 0:
- name = socket.gethostname()
- try:
- hostname, aliases, ipaddrs = socket.gethostbyaddr(name)
- except socket.error:
- pass
- else:
- aliases.insert(0, hostname)
- for name in aliases:
- if '.' in name:
- break
- else:
- name = hostname
- return name
-
-
class SMTP:
"""This class manages a connection to an SMTP or ESMTP server.
--- 134,138 ----
***************
*** 318,322 ****
self.putcmd("helo", name)
else:
! self.putcmd("helo", make_fqdn())
(code,msg)=self.getreply()
self.helo_resp=msg
--- 293,297 ----
self.putcmd("helo", name)
else:
! self.putcmd("helo", socket.getfqdn())
(code,msg)=self.getreply()
self.helo_resp=msg
***************
*** 331,335 ****
self.putcmd("ehlo", name)
else:
! self.putcmd("ehlo", make_fqdn())
(code,msg)=self.getreply()
# According to RFC1869 some (badly written)
--- 306,310 ----
self.putcmd("ehlo", name)
else:
! self.putcmd("ehlo", socket.getfqdn())
(code,msg)=self.getreply()
# According to RFC1869 some (badly written)