mirror of
https://github.com/python/cpython.git
synced 2025-11-30 06:48:54 +00:00
bug #1462706: guard against host not having FQDN hostname
This commit is contained in:
parent
31fe35bdee
commit
4eb521e595
1 changed files with 5 additions and 2 deletions
|
|
@ -1130,8 +1130,11 @@ class FileHandler(BaseHandler):
|
||||||
names = None
|
names = None
|
||||||
def get_names(self):
|
def get_names(self):
|
||||||
if FileHandler.names is None:
|
if FileHandler.names is None:
|
||||||
FileHandler.names = (socket.gethostbyname('localhost'),
|
try:
|
||||||
socket.gethostbyname(socket.gethostname()))
|
FileHandler.names = (socket.gethostbyname('localhost'),
|
||||||
|
socket.gethostbyname(socket.gethostname()))
|
||||||
|
except socket.gaierror:
|
||||||
|
FileHandler.names = (socket.gethostbyname('localhost'),)
|
||||||
return FileHandler.names
|
return FileHandler.names
|
||||||
|
|
||||||
# not entirely sure what the rules are here
|
# not entirely sure what the rules are here
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue