bug #1462706: guard against host not having FQDN hostname

This commit is contained in:
Georg Brandl 2006-04-02 20:37:17 +00:00
parent 31fe35bdee
commit 4eb521e595
1 changed files with 5 additions and 2 deletions

View File

@ -1130,8 +1130,11 @@ class FileHandler(BaseHandler):
names = None
def get_names(self):
if FileHandler.names is None:
FileHandler.names = (socket.gethostbyname('localhost'),
socket.gethostbyname(socket.gethostname()))
try:
FileHandler.names = (socket.gethostbyname('localhost'),
socket.gethostbyname(socket.gethostname()))
except socket.gaierror:
FileHandler.names = (socket.gethostbyname('localhost'),)
return FileHandler.names
# not entirely sure what the rules are here