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
ab53ab0a
Kaydet (Commit)
ab53ab0a
authored
Şub 03, 2015
tarafından
Berker Peksag
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #13128: Print response headers for CONNECT requests when debuglevel > 0.
Patch by Demian Brecht.
üst
50457403
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
5 deletions
+24
-5
client.py
Lib/http/client.py
+3
-0
test_httplib.py
Lib/test/test_httplib.py
+18
-5
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/http/client.py
Dosyayı görüntüle @
ab53ab0a
...
...
@@ -776,6 +776,9 @@ class HTTPConnection:
if
line
in
(
b
'
\r\n
'
,
b
'
\n
'
,
b
''
):
break
if
self
.
debuglevel
>
0
:
print
(
'header:'
,
line
.
decode
())
def
connect
(
self
):
"""Connect to the host and port specified in __init__."""
self
.
sock
=
self
.
_create_connection
(
...
...
Lib/test/test_httplib.py
Dosyayı görüntüle @
ab53ab0a
...
...
@@ -1269,17 +1269,18 @@ class TunnelTests(TestCase):
'HTTP/1.1 200 OK
\r\n
'
# Reply to HEAD
'Content-Length: 42
\r\n\r\n
'
)
def
create_connection
(
address
,
timeout
=
None
,
source_address
=
None
):
return
FakeSocket
(
response_text
,
host
=
address
[
0
],
port
=
address
[
1
])
self
.
host
=
'proxy.com'
self
.
conn
=
client
.
HTTPConnection
(
self
.
host
)
self
.
conn
.
_create_connection
=
create_connection
self
.
conn
.
_create_connection
=
self
.
_create_connection
(
response_text
)
def
tearDown
(
self
):
self
.
conn
.
close
()
def
_create_connection
(
self
,
response_text
):
def
create_connection
(
address
,
timeout
=
None
,
source_address
=
None
):
return
FakeSocket
(
response_text
,
host
=
address
[
0
],
port
=
address
[
1
])
return
create_connection
def
test_set_tunnel_host_port_headers
(
self
):
tunnel_host
=
'destination.com'
tunnel_port
=
8888
...
...
@@ -1320,6 +1321,18 @@ class TunnelTests(TestCase):
self
.
assertIn
(
b
'CONNECT destination.com'
,
self
.
conn
.
sock
.
data
)
self
.
assertIn
(
b
'Host: destination.com'
,
self
.
conn
.
sock
.
data
)
def
test_tunnel_debuglog
(
self
):
expected_header
=
'X-Dummy: 1'
response_text
=
'HTTP/1.0 200 OK
\r\n
{}
\r\n\r\n
'
.
format
(
expected_header
)
self
.
conn
.
set_debuglevel
(
1
)
self
.
conn
.
_create_connection
=
self
.
_create_connection
(
response_text
)
self
.
conn
.
set_tunnel
(
'destination.com'
)
with
support
.
captured_stdout
()
as
output
:
self
.
conn
.
request
(
'PUT'
,
'/'
,
''
)
lines
=
output
.
getvalue
()
.
splitlines
()
self
.
assertIn
(
'header: {}'
.
format
(
expected_header
),
lines
)
@support.reap_threads
...
...
Misc/NEWS
Dosyayı görüntüle @
ab53ab0a
...
...
@@ -232,6 +232,9 @@ Core and Builtins
Library
-------
- Issue #13128: Print response headers for CONNECT requests when debuglevel
> 0. Patch by Demian Brecht.
- Issue #15381: Optimized io.BytesIO to make less allocations and copyings.
- Issue #22818: Splitting on a pattern that could match an empty string now
...
...
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