Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2d2785aa
Commit
2d2785aa
authored
Aug 16, 2000
by
Peter Schneider-Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated occurences of fqdn algorithm (closes patch #101197)
parent
77c9f504
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
36 deletions
+8
-36
Lib/BaseHTTPServer.py
Lib/BaseHTTPServer.py
+3
-23
Lib/ftplib.py
Lib/ftplib.py
+4
-12
Lib/socket.py
Lib/socket.py
+1
-1
No files found.
Lib/BaseHTTPServer.py
View file @
2d2785aa
...
...
@@ -93,19 +93,7 @@ class HTTPServer(SocketServer.TCPServer):
"""Override server_bind to store the server name."""
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_name
=
socket
.
getfqdn
(
host
)
self
.
server_port
=
port
...
...
@@ -418,16 +406,8 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
"""
(
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
]
host
,
port
=
self
.
client_address
return
socket
.
getfqdn
(
host
)
# Essentially static class variables
...
...
Lib/ftplib.py
View file @
2d2785aa
...
...
@@ -41,7 +41,8 @@ import string
# Import SOCKS module if it exists, else standard socket module socket
try
:
import
SOCKS
;
socket
=
SOCKS
import
SOCKS
;
socket
=
SOCKS
;
del
SOCKS
# import SOCKS as socket
from
socket
import
getfqdn
;
socket
.
getfqdn
=
getfqdn
;
del
getfqdn
except
ImportError
:
import
socket
...
...
@@ -291,17 +292,8 @@ class FTP:
if
not
passwd
:
passwd
=
''
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
# get fully qualified domain name of local host
thishost
=
socket
.
getfqdn
()
try
:
if
os
.
environ
.
has_key
(
'LOGNAME'
):
realuser
=
os
.
environ
[
'LOGNAME'
]
...
...
Lib/socket.py
View file @
2d2785aa
...
...
@@ -85,7 +85,7 @@ def getfqdn(name=''):
is returned.
"""
name
=
name
.
strip
()
if
len
(
name
)
==
0
:
if
not
name
or
name
==
'0.0.0.0'
:
name
=
gethostname
()
try
:
hostname
,
aliases
,
ipaddrs
=
gethostbyaddr
(
name
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment