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
dd5a8607
Kaydet (Commit)
dd5a8607
authored
Haz 30, 2007
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix test_httplib.
üst
486364b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
httplib.py
Lib/httplib.py
+8
-7
test_httplib.py
Lib/test/test_httplib.py
+2
-2
No files found.
Lib/httplib.py
Dosyayı görüntüle @
dd5a8607
...
@@ -711,8 +711,8 @@ class HTTPConnection:
...
@@ -711,8 +711,8 @@ class HTTPConnection:
Appends an extra
\\
r
\\
n to the buffer.
Appends an extra
\\
r
\\
n to the buffer.
"""
"""
self
.
_buffer
.
extend
((
""
,
""
))
self
.
_buffer
.
extend
((
b
""
,
b
""
))
msg
=
"
\r\n
"
.
join
(
self
.
_buffer
)
msg
=
b
"
\r\n
"
.
join
(
self
.
_buffer
)
del
self
.
_buffer
[:]
del
self
.
_buffer
[:]
self
.
send
(
msg
)
self
.
send
(
msg
)
...
@@ -758,9 +758,10 @@ class HTTPConnection:
...
@@ -758,9 +758,10 @@ class HTTPConnection:
self
.
_method
=
method
self
.
_method
=
method
if
not
url
:
if
not
url
:
url
=
'/'
url
=
'/'
str
=
'
%
s
%
s
%
s'
%
(
method
,
url
,
self
.
_http_vsn_str
)
request
=
'
%
s
%
s
%
s'
%
(
method
,
url
,
self
.
_http_vsn_str
)
self
.
_output
(
str
)
# Non-ASCII characters should have been eliminated earlier
self
.
_output
(
request
.
encode
(
'ascii'
))
if
self
.
_http_vsn
==
11
:
if
self
.
_http_vsn
==
11
:
# Issue some standard headers for better HTTP/1.1 compliance
# Issue some standard headers for better HTTP/1.1 compliance
...
@@ -831,8 +832,8 @@ class HTTPConnection:
...
@@ -831,8 +832,8 @@ class HTTPConnection:
if
self
.
__state
!=
_CS_REQ_STARTED
:
if
self
.
__state
!=
_CS_REQ_STARTED
:
raise
CannotSendHeader
()
raise
CannotSendHeader
()
st
r
=
'
%
s:
%
s'
%
(
header
,
value
)
heade
r
=
'
%
s:
%
s'
%
(
header
,
value
)
self
.
_output
(
str
)
self
.
_output
(
header
.
encode
(
'ascii'
)
)
def
endheaders
(
self
):
def
endheaders
(
self
):
"""Indicate that the last header line has been sent to the server."""
"""Indicate that the last header line has been sent to the server."""
...
@@ -846,7 +847,6 @@ class HTTPConnection:
...
@@ -846,7 +847,6 @@ class HTTPConnection:
def
request
(
self
,
method
,
url
,
body
=
None
,
headers
=
{}):
def
request
(
self
,
method
,
url
,
body
=
None
,
headers
=
{}):
"""Send a complete request to the server."""
"""Send a complete request to the server."""
try
:
try
:
self
.
_send_request
(
method
,
url
,
body
,
headers
)
self
.
_send_request
(
method
,
url
,
body
,
headers
)
except
socket
.
error
as
v
:
except
socket
.
error
as
v
:
...
@@ -888,6 +888,7 @@ class HTTPConnection:
...
@@ -888,6 +888,7 @@ class HTTPConnection:
self
.
endheaders
()
self
.
endheaders
()
if
body
:
if
body
:
if
isinstance
(
body
,
str
):
body
=
body
.
encode
(
'ascii'
)
self
.
send
(
body
)
self
.
send
(
body
)
def
getresponse
(
self
):
def
getresponse
(
self
):
...
...
Lib/test/test_httplib.py
Dosyayı görüntüle @
dd5a8607
...
@@ -11,7 +11,7 @@ class FakeSocket:
...
@@ -11,7 +11,7 @@ class FakeSocket:
def
__init__
(
self
,
text
,
fileclass
=
StringIO
.
StringIO
):
def
__init__
(
self
,
text
,
fileclass
=
StringIO
.
StringIO
):
self
.
text
=
text
self
.
text
=
text
self
.
fileclass
=
fileclass
self
.
fileclass
=
fileclass
self
.
data
=
''
self
.
data
=
b
''
def
sendall
(
self
,
data
):
def
sendall
(
self
,
data
):
self
.
data
+=
data
self
.
data
+=
data
...
@@ -54,7 +54,7 @@ class HeaderTests(TestCase):
...
@@ -54,7 +54,7 @@ class HeaderTests(TestCase):
kv
=
item
.
split
(
':'
)
kv
=
item
.
split
(
':'
)
if
len
(
kv
)
>
1
:
if
len
(
kv
)
>
1
:
# item is a 'Key: Value' header string
# item is a 'Key: Value' header string
lcKey
=
kv
[
0
]
.
lower
()
lcKey
=
kv
[
0
]
.
decode
(
'ascii'
)
.
lower
()
self
.
count
.
setdefault
(
lcKey
,
0
)
self
.
count
.
setdefault
(
lcKey
,
0
)
self
.
count
[
lcKey
]
+=
1
self
.
count
[
lcKey
]
+=
1
list
.
append
(
self
,
item
)
list
.
append
(
self
,
item
)
...
...
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