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
c1b2cb9d
Kaydet (Commit)
c1b2cb9d
authored
May 05, 2003
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SF bug 622042: Don't expect response body from HEAD request.
Bug fix candidate.
üst
581c3677
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
4 deletions
+25
-4
httplib.py
Lib/httplib.py
+11
-4
test_httplib.py
Lib/test/test_httplib.py
+13
-0
ACKS
Misc/ACKS
+1
-0
No files found.
Lib/httplib.py
Dosyayı görüntüle @
c1b2cb9d
...
@@ -208,10 +208,11 @@ class HTTPResponse:
...
@@ -208,10 +208,11 @@ class HTTPResponse:
# See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details.
# See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details.
def
__init__
(
self
,
sock
,
debuglevel
=
0
,
strict
=
0
):
def
__init__
(
self
,
sock
,
debuglevel
=
0
,
strict
=
0
,
method
=
None
):
self
.
fp
=
sock
.
makefile
(
'rb'
,
0
)
self
.
fp
=
sock
.
makefile
(
'rb'
,
0
)
self
.
debuglevel
=
debuglevel
self
.
debuglevel
=
debuglevel
self
.
strict
=
strict
self
.
strict
=
strict
self
.
_method
=
method
self
.
msg
=
None
self
.
msg
=
None
...
@@ -326,7 +327,8 @@ class HTTPResponse:
...
@@ -326,7 +327,8 @@ class HTTPResponse:
# does the body have a fixed length? (of zero)
# does the body have a fixed length? (of zero)
if
(
status
==
204
or
# No Content
if
(
status
==
204
or
# No Content
status
==
304
or
# Not Modified
status
==
304
or
# Not Modified
100
<=
status
<
200
):
# 1xx codes
100
<=
status
<
200
or
# 1xx codes
self
.
_method
==
'HEAD'
):
self
.
length
=
0
self
.
length
=
0
# if the connection remains open, and we aren't using chunked, and
# if the connection remains open, and we aren't using chunked, and
...
@@ -497,6 +499,7 @@ class HTTPConnection:
...
@@ -497,6 +499,7 @@ class HTTPConnection:
self
.
_buffer
=
[]
self
.
_buffer
=
[]
self
.
__response
=
None
self
.
__response
=
None
self
.
__state
=
_CS_IDLE
self
.
__state
=
_CS_IDLE
self
.
_method
=
None
self
.
_set_hostport
(
host
,
port
)
self
.
_set_hostport
(
host
,
port
)
if
strict
is
not
None
:
if
strict
is
not
None
:
...
@@ -626,6 +629,8 @@ class HTTPConnection:
...
@@ -626,6 +629,8 @@ class HTTPConnection:
else
:
else
:
raise
CannotSendRequest
()
raise
CannotSendRequest
()
# Save the method we use, we need it later in the response phase
self
.
_method
=
method
if
not
url
:
if
not
url
:
url
=
'/'
url
=
'/'
str
=
'
%
s
%
s
%
s'
%
(
method
,
url
,
self
.
_http_vsn_str
)
str
=
'
%
s
%
s
%
s'
%
(
method
,
url
,
self
.
_http_vsn_str
)
...
@@ -763,9 +768,11 @@ class HTTPConnection:
...
@@ -763,9 +768,11 @@ class HTTPConnection:
if
self
.
debuglevel
>
0
:
if
self
.
debuglevel
>
0
:
response
=
self
.
response_class
(
self
.
sock
,
self
.
debuglevel
,
response
=
self
.
response_class
(
self
.
sock
,
self
.
debuglevel
,
strict
=
self
.
strict
)
strict
=
self
.
strict
,
method
=
self
.
_method
)
else
:
else
:
response
=
self
.
response_class
(
self
.
sock
,
strict
=
self
.
strict
)
response
=
self
.
response_class
(
self
.
sock
,
strict
=
self
.
strict
,
method
=
self
.
_method
)
response
.
begin
()
response
.
begin
()
assert
response
.
will_close
!=
_UNKNOWN
assert
response
.
will_close
!=
_UNKNOWN
...
...
Lib/test/test_httplib.py
Dosyayı görüntüle @
c1b2cb9d
...
@@ -78,4 +78,17 @@ def _test():
...
@@ -78,4 +78,17 @@ def _test():
if
cookies
!=
hdr
:
if
cookies
!=
hdr
:
raise
AssertionError
,
"multiple headers not combined properly"
raise
AssertionError
,
"multiple headers not combined properly"
# test that the library doesn't attempt to read any data
# from a head request
conn
=
httplib
.
HTTPConnection
(
"www.python.org"
)
conn
.
connect
()
conn
.
request
(
"HEAD"
,
"/"
,
headers
=
{
"Connection"
:
"keep-alive"
})
resp
=
conn
.
getresponse
()
if
resp
.
status
!=
200
:
raise
AssertionError
,
"Expected status 200, got
%
d"
%
resp
.
status
if
resp
.
read
()
!=
""
:
raise
AssertionError
,
"Did not expect response from HEAD request"
resp
.
close
()
conn
.
close
()
test
()
test
()
Misc/ACKS
Dosyayı görüntüle @
c1b2cb9d
...
@@ -261,6 +261,7 @@ Michael Hudson
...
@@ -261,6 +261,7 @@ Michael Hudson
Jim Hugunin
Jim Hugunin
Greg Humphreys
Greg Humphreys
Jeremy Hylton
Jeremy Hylton
Mihai Ibanescu
Juan David Ibez Palomar
Juan David Ibez Palomar
Tony Ingraldi
Tony Ingraldi
John Interrante
John Interrante
...
...
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