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
b75a0e9f
Kaydet (Commit)
b75a0e9f
authored
Eyl 07, 2015
tarafından
Martin Panter
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17849: Raise sensible exception for invalid HTTP tunnel response
Initial patch from Cory Benfield.
üst
04861dc8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
0 deletions
+20
-0
httplib.py
Lib/httplib.py
+5
-0
test_httplib.py
Lib/test/test_httplib.py
+10
-0
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+4
-0
No files found.
Lib/httplib.py
Dosyayı görüntüle @
b75a0e9f
...
@@ -810,6 +810,11 @@ class HTTPConnection:
...
@@ -810,6 +810,11 @@ class HTTPConnection:
method
=
self
.
_method
)
method
=
self
.
_method
)
(
version
,
code
,
message
)
=
response
.
_read_status
()
(
version
,
code
,
message
)
=
response
.
_read_status
()
if
version
==
"HTTP/0.9"
:
# HTTP/0.9 doesn't support the CONNECT verb, so if httplib has
# concluded HTTP/0.9 is being used something has gone wrong.
self
.
close
()
raise
socket
.
error
(
"Invalid response from tunnel request"
)
if
code
!=
200
:
if
code
!=
200
:
self
.
close
()
self
.
close
()
raise
socket
.
error
(
"Tunnel connection failed:
%
d
%
s"
%
(
code
,
raise
socket
.
error
(
"Tunnel connection failed:
%
d
%
s"
%
(
code
,
...
...
Lib/test/test_httplib.py
Dosyayı görüntüle @
b75a0e9f
...
@@ -578,6 +578,16 @@ class BasicTest(TestCase):
...
@@ -578,6 +578,16 @@ class BasicTest(TestCase):
#self.assertTrue(response[0].closed)
#self.assertTrue(response[0].closed)
self
.
assertTrue
(
conn
.
sock
.
file_closed
)
self
.
assertTrue
(
conn
.
sock
.
file_closed
)
def
test_proxy_tunnel_without_status_line
(
self
):
# Issue 17849: If a proxy tunnel is created that does not return
# a status code, fail.
body
=
'hello world'
conn
=
httplib
.
HTTPConnection
(
'example.com'
,
strict
=
False
)
conn
.
set_tunnel
(
'foo'
)
conn
.
sock
=
FakeSocket
(
body
)
with
self
.
assertRaisesRegexp
(
socket
.
error
,
"Invalid response"
):
conn
.
_tunnel
()
class
OfflineTest
(
TestCase
):
class
OfflineTest
(
TestCase
):
def
test_responses
(
self
):
def
test_responses
(
self
):
self
.
assertEqual
(
httplib
.
responses
[
httplib
.
NOT_FOUND
],
"Not Found"
)
self
.
assertEqual
(
httplib
.
responses
[
httplib
.
NOT_FOUND
],
"Not Found"
)
...
...
Misc/ACKS
Dosyayı görüntüle @
b75a0e9f
...
@@ -107,6 +107,7 @@ Ben Bell
...
@@ -107,6 +107,7 @@ Ben Bell
Thomas Bellman
Thomas Bellman
Alexander “Саша” Belopolsky
Alexander “Саша” Belopolsky
Eli Bendersky
Eli Bendersky
Cory Benfield
David Benjamin
David Benjamin
Oscar Benjamin
Oscar Benjamin
Andrew Bennetts
Andrew Bennetts
...
...
Misc/NEWS
Dosyayı görüntüle @
b75a0e9f
...
@@ -37,6 +37,10 @@ Core and Builtins
...
@@ -37,6 +37,10 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
17849
:
Raise
a
sensible
exception
if
an
invalid
response
is
received
for
a
HTTP
tunnel
request
,
as
seen
with
some
servers
that
do
not
support
tunnelling
.
Initial
patch
from
Cory
Benfield
.
-
Issue
#
16180
:
Exit
pdb
if
file
has
syntax
error
,
instead
of
trapping
user
-
Issue
#
16180
:
Exit
pdb
if
file
has
syntax
error
,
instead
of
trapping
user
in
an
infinite
loop
.
Patch
by
Xavier
de
Gaye
.
in
an
infinite
loop
.
Patch
by
Xavier
de
Gaye
.
...
...
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