[Python-checkins] CVS: python/dist/src/Lib BaseHTTPServer.py,1.10,1.11 ftplib.py,1.42,1.43 socket.py,1.1,1.2
Peter Schneider-Kamp
python-dev@python.org
Wed, 16 Aug 2000 13:30:23 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv10308
Modified Files:
BaseHTTPServer.py ftplib.py socket.py
Log Message:
updated occurences of fqdn algorithm (closes patch #101197)
Index: BaseHTTPServer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/BaseHTTPServer.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** BaseHTTPServer.py 2000/05/09 14:54:13 1.10
--- BaseHTTPServer.py 2000/08/16 20:30:21 1.11
***************
*** 94,110 ****
SocketServer.TCPServer.server_bind(self)
host, port = self.socket.getsockname()
! if not host or host == '0.0.0.0':
! host = socket.gethostname()
! try:
! hostname, hostnames, hostaddrs = socket.gethostbyaddr(host)
! except socket.error:
! hostname = host
! else:
! if '.' not in hostname:
! for host in hostnames:
! if '.' in host:
! hostname = host
! break
! self.server_name = hostname
self.server_port = port
--- 94,98 ----
SocketServer.TCPServer.server_bind(self)
host, port = self.socket.getsockname()
! self.server_name = socket.getfqdn(host)
self.server_port = port
***************
*** 418,432 ****
"""
-
- (host, port) = self.client_address
- try:
- name, names, addresses = socket.gethostbyaddr(host)
- except socket.error, msg:
- return host
- names.insert(0, name)
- for name in names:
- if '.' in name: return name
- return names[0]
# Essentially static class variables
--- 406,412 ----
"""
+ host, port = self.client_address
+ return socket.getfqdn(host)
# Essentially static class variables
Index: ftplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ftplib.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -r1.42 -r1.43
*** ftplib.py 2000/03/28 21:45:45 1.42
--- ftplib.py 2000/08/16 20:30:21 1.43
***************
*** 42,46 ****
# Import SOCKS module if it exists, else standard socket module socket
try:
! import SOCKS; socket = SOCKS
except ImportError:
import socket
--- 42,47 ----
# Import SOCKS module if it exists, else standard socket module socket
try:
! import SOCKS; socket = SOCKS; del SOCKS # import SOCKS as socket
! from socket import getfqdn; socket.getfqdn = getfqdn; del getfqdn
except ImportError:
import socket
***************
*** 292,306 ****
if not acct: acct = ''
if user == 'anonymous' and passwd in ('', '-'):
! thishost = socket.gethostname()
! # Make sure it is fully qualified
! if not '.' in thishost:
! thisaddr = socket.gethostbyname(thishost)
! firstname, names, unused = \
! socket.gethostbyaddr(thisaddr)
! names.insert(0, firstname)
! for name in names:
! if '.' in name:
! thishost = name
! break
try:
if os.environ.has_key('LOGNAME'):
--- 293,298 ----
if not acct: acct = ''
if user == 'anonymous' and passwd in ('', '-'):
! # get fully qualified domain name of local host
! thishost = socket.getfqdn()
try:
if os.environ.has_key('LOGNAME'):
Index: socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** socket.py 2000/08/16 14:14:31 1.1
--- socket.py 2000/08/16 20:30:21 1.2
***************
*** 86,90 ****
"""
name = name.strip()
! if len(name) == 0:
name = gethostname()
try:
--- 86,90 ----
"""
name = name.strip()
! if not name or name == '0.0.0.0':
name = gethostname()
try: