Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
1aacba49
Kaydet (Commit)
1aacba49
authored
Nis 29, 2012
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix Issue6085 - SimpleHTTPServer address_string to return client ip instead of client hostname
üst
0ce16496
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
13 deletions
+10
-13
http.server.rst
Doc/library/http.server.rst
+5
-2
server.py
Lib/http/server.py
+2
-11
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/http.server.rst
Dosyayı görüntüle @
1aacba49
...
...
@@ -269,8 +269,11 @@ of which this module provides three different variants:
.. method:: address_string()
Returns the client address, formatted for logging. A name lookup is
performed on the client's IP address.
Returns the client address.
.. versionchanged:: 3.3
Previously, a name lookup was performed. To avoid name resolution
delays, it now always returns the IP address.
.. class:: SimpleHTTPRequestHandler(request, client_address, server)
...
...
Lib/http/server.py
Dosyayı görüntüle @
1aacba49
...
...
@@ -558,15 +558,9 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
'Jul'
,
'Aug'
,
'Sep'
,
'Oct'
,
'Nov'
,
'Dec'
]
def
address_string
(
self
):
"""Return the client address
formatted for logging.
"""Return the client address
."""
This version looks up the full hostname using gethostbyaddr(),
and tries to find a name that contains at least one dot.
"""
host
,
port
=
self
.
client_address
[:
2
]
return
socket
.
getfqdn
(
host
)
return
self
.
client_address
[
0
]
# Essentially static class variables
...
...
@@ -1040,9 +1034,6 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
env
[
'SCRIPT_NAME'
]
=
scriptname
if
query
:
env
[
'QUERY_STRING'
]
=
query
host
=
self
.
address_string
()
if
host
!=
self
.
client_address
[
0
]:
env
[
'REMOTE_HOST'
]
=
host
env
[
'REMOTE_ADDR'
]
=
self
.
client_address
[
0
]
authorization
=
self
.
headers
.
get
(
"authorization"
)
if
authorization
:
...
...
Misc/NEWS
Dosyayı görüntüle @
1aacba49
...
...
@@ -81,6 +81,9 @@ Core and Builtins
Library
-------
- Issue #6085: In http.server.py SimpleHTTPServer.address_string returns the
client ip address instead client hostname. Patch by Charles-François Natali.
- Issue #14309: Deprecate time.clock(), use time.perf_counter() or
time.process_time() instead.
...
...
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