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
6c4e1aed
Kaydet (Commit)
6c4e1aed
authored
Eki 19, 2011
tarafından
Łukasz Langa
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merged fix for #10860 from 3.2
üst
55c7e00f
a5a9a9c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
client.py
Lib/http/client.py
+4
-1
test_httplib.py
Lib/test/test_httplib.py
+22
-2
No files found.
Lib/http/client.py
Dosyayı görüntüle @
6c4e1aed
...
@@ -678,7 +678,10 @@ class HTTPConnection:
...
@@ -678,7 +678,10 @@ class HTTPConnection:
try
:
try
:
port
=
int
(
host
[
i
+
1
:])
port
=
int
(
host
[
i
+
1
:])
except
ValueError
:
except
ValueError
:
raise
InvalidURL
(
"nonnumeric port: '
%
s'"
%
host
[
i
+
1
:])
if
host
[
i
+
1
:]
==
""
:
# http://foo.com:/ == http://foo.com/
port
=
self
.
default_port
else
:
raise
InvalidURL
(
"nonnumeric port: '
%
s'"
%
host
[
i
+
1
:])
host
=
host
[:
i
]
host
=
host
[:
i
]
else
:
else
:
port
=
self
.
default_port
port
=
self
.
default_port
...
...
Lib/test/test_httplib.py
Dosyayı görüntüle @
6c4e1aed
...
@@ -161,14 +161,16 @@ class BasicTest(TestCase):
...
@@ -161,14 +161,16 @@ class BasicTest(TestCase):
def
test_host_port
(
self
):
def
test_host_port
(
self
):
# Check invalid host_port
# Check invalid host_port
for
hp
in
(
"www.python.org:abc"
,
"
www.python.org:
"
):
for
hp
in
(
"www.python.org:abc"
,
"
user:password@www.python.org
"
):
self
.
assertRaises
(
client
.
InvalidURL
,
client
.
HTTPConnection
,
hp
)
self
.
assertRaises
(
client
.
InvalidURL
,
client
.
HTTPConnection
,
hp
)
for
hp
,
h
,
p
in
((
"[fe80::207:e9ff:fe9b]:8000"
,
for
hp
,
h
,
p
in
((
"[fe80::207:e9ff:fe9b]:8000"
,
"fe80::207:e9ff:fe9b"
,
8000
),
"fe80::207:e9ff:fe9b"
,
8000
),
(
"www.python.org:80"
,
"www.python.org"
,
80
),
(
"www.python.org:80"
,
"www.python.org"
,
80
),
(
"www.python.org:"
,
"www.python.org"
,
80
),
(
"www.python.org"
,
"www.python.org"
,
80
),
(
"www.python.org"
,
"www.python.org"
,
80
),
(
"[fe80::207:e9ff:fe9b]"
,
"fe80::207:e9ff:fe9b"
,
80
)):
(
"[fe80::207:e9ff:fe9b]"
,
"fe80::207:e9ff:fe9b"
,
80
),
(
"[fe80::207:e9ff:fe9b]:"
,
"fe80::207:e9ff:fe9b"
,
80
)):
c
=
client
.
HTTPConnection
(
hp
)
c
=
client
.
HTTPConnection
(
hp
)
self
.
assertEqual
(
h
,
c
.
host
)
self
.
assertEqual
(
h
,
c
.
host
)
self
.
assertEqual
(
p
,
c
.
port
)
self
.
assertEqual
(
p
,
c
.
port
)
...
@@ -539,6 +541,24 @@ class HTTPSTest(TestCase):
...
@@ -539,6 +541,24 @@ class HTTPSTest(TestCase):
self
.
assertEqual
(
resp
.
status
,
404
)
self
.
assertEqual
(
resp
.
status
,
404
)
del
server
del
server
def
test_host_port
(
self
):
# Check invalid host_port
for
hp
in
(
"www.python.org:abc"
,
"user:password@www.python.org"
):
self
.
assertRaises
(
client
.
InvalidURL
,
client
.
HTTPSConnection
,
hp
)
for
hp
,
h
,
p
in
((
"[fe80::207:e9ff:fe9b]:8000"
,
"fe80::207:e9ff:fe9b"
,
8000
),
(
"www.python.org:443"
,
"www.python.org"
,
443
),
(
"www.python.org:"
,
"www.python.org"
,
443
),
(
"www.python.org"
,
"www.python.org"
,
443
),
(
"[fe80::207:e9ff:fe9b]"
,
"fe80::207:e9ff:fe9b"
,
443
),
(
"[fe80::207:e9ff:fe9b]:"
,
"fe80::207:e9ff:fe9b"
,
443
)):
c
=
client
.
HTTPSConnection
(
hp
)
self
.
assertEqual
(
h
,
c
.
host
)
self
.
assertEqual
(
p
,
c
.
port
)
class
RequestBodyTest
(
TestCase
):
class
RequestBodyTest
(
TestCase
):
"""Test cases where a request includes a message body."""
"""Test cases where a request includes a message body."""
...
...
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