mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
In helo() and ehlo(), Don't fail when gethostbyaddr() fails -- just
keep whatever gethostname() returns. After a suggestion by Doug Wyatt.
This commit is contained in:
parent
d6512808f0
commit
bda10c81d0
1 changed files with 10 additions and 2 deletions
|
@ -290,7 +290,11 @@ class SMTP:
|
|||
"""
|
||||
name=string.strip(name)
|
||||
if len(name)==0:
|
||||
name=socket.gethostbyaddr(socket.gethostname())[0]
|
||||
name = socket.gethostname()
|
||||
try:
|
||||
name = socket.gethostbyaddr(name)[0]
|
||||
except socket.error:
|
||||
pass
|
||||
self.putcmd("helo",name)
|
||||
(code,msg)=self.getreply()
|
||||
self.helo_resp=msg
|
||||
|
@ -303,7 +307,11 @@ class SMTP:
|
|||
"""
|
||||
name=string.strip(name)
|
||||
if len(name)==0:
|
||||
name=socket.gethostbyaddr(socket.gethostname())[0]
|
||||
name = socket.gethostname()
|
||||
try:
|
||||
name = socket.gethostbyaddr(name)[0]
|
||||
except socket.error:
|
||||
pass
|
||||
self.putcmd("ehlo",name)
|
||||
(code,msg)=self.getreply()
|
||||
# According to RFC1869 some (badly written)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue