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
74ebd9e6
Kaydet (Commit)
74ebd9e6
authored
Kas 13, 2010
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix Issue5111 - Wrap the Ipv6 host with [] in the Host header
üst
5ccafbad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
0 deletions
+28
-0
client.py
Lib/http/client.py
+7
-0
test_httplib.py
Lib/test/test_httplib.py
+19
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/http/client.py
Dosyayı görüntüle @
74ebd9e6
...
@@ -874,6 +874,13 @@ class HTTPConnection:
...
@@ -874,6 +874,13 @@ class HTTPConnection:
host_enc
=
self
.
host
.
encode
(
"ascii"
)
host_enc
=
self
.
host
.
encode
(
"ascii"
)
except
UnicodeEncodeError
:
except
UnicodeEncodeError
:
host_enc
=
self
.
host
.
encode
(
"idna"
)
host_enc
=
self
.
host
.
encode
(
"idna"
)
# As per RFC 273, IPv6 address should be wrapped with []
# when used as Host header
if
self
.
host
.
find
(
':'
)
>=
0
:
host_enc
=
b
'['
+
host_enc
+
b
']'
if
self
.
port
==
self
.
default_port
:
if
self
.
port
==
self
.
default_port
:
self
.
putheader
(
'Host'
,
host_enc
)
self
.
putheader
(
'Host'
,
host_enc
)
else
:
else
:
...
...
Lib/test/test_httplib.py
Dosyayı görüntüle @
74ebd9e6
...
@@ -106,6 +106,25 @@ class HeaderTests(TestCase):
...
@@ -106,6 +106,25 @@ class HeaderTests(TestCase):
conn
.
putheader
(
'Content-length'
,
42
)
conn
.
putheader
(
'Content-length'
,
42
)
self
.
assertTrue
(
b
'Content-length: 42'
in
conn
.
_buffer
)
self
.
assertTrue
(
b
'Content-length: 42'
in
conn
.
_buffer
)
def
test_ipv6host_header
(
self
):
# Default host header on IPv6 transaction should wrapped by [] if
# its actual IPv6 address
expected
=
b
'GET /foo HTTP/1.1
\r\n
Host: [2001::]:81
\r\n
'
\
b
'Accept-Encoding: identity
\r\n\r\n
'
conn
=
client
.
HTTPConnection
(
'[2001::]:81'
)
sock
=
FakeSocket
(
''
)
conn
.
sock
=
sock
conn
.
request
(
'GET'
,
'/foo'
)
self
.
assertTrue
(
sock
.
data
.
startswith
(
expected
))
expected
=
b
'GET /foo HTTP/1.1
\r\n
Host: [2001:102A::]
\r\n
'
\
b
'Accept-Encoding: identity
\r\n\r\n
'
conn
=
client
.
HTTPConnection
(
'[2001:102A::]'
)
sock
=
FakeSocket
(
''
)
conn
.
sock
=
sock
conn
.
request
(
'GET'
,
'/foo'
)
self
.
assertTrue
(
sock
.
data
.
startswith
(
expected
))
class
BasicTest
(
TestCase
):
class
BasicTest
(
TestCase
):
def
test_status_lines
(
self
):
def
test_status_lines
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
74ebd9e6
...
@@ -63,6 +63,8 @@ Core and Builtins
...
@@ -63,6 +63,8 @@ Core and Builtins
Library
Library
-------
-------
- Issue #5111: IPv6 Host in the Header is wrapped inside [ ]. Patch by Chandru.
- Fix Fraction.__hash__ so that Fraction.__hash__(-1) is -2. (See
- Fix Fraction.__hash__ so that Fraction.__hash__(-1) is -2. (See
also issue #10356.)
also issue #10356.)
...
...
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