This repository was archived by the owner on Jan 13, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,25 @@ def test_basic_request(self):
116
116
117
117
assert received == expected
118
118
119
+ def test_proxy_request (self ):
120
+ c = HTTP11Connection ('httpbin.org' , proxy_host = 'localhost' )
121
+ c ._sock = sock = DummySocket ()
122
+
123
+ c .request ('GET' , '/get' , headers = {'User-Agent' : 'hyper' })
124
+
125
+ expected = (
126
+ b"GET /get HTTP/1.1\r \n "
127
+ b"User-Agent: hyper\r \n "
128
+ b"connection: Upgrade, HTTP2-Settings\r \n "
129
+ b"upgrade: h2c\r \n "
130
+ b"HTTP2-Settings: AAQAAP//\r \n "
131
+ b"host: httpbin.org\r \n "
132
+ b"\r \n "
133
+ )
134
+ received = b'' .join (sock .queue )
135
+
136
+ assert received == expected
137
+
119
138
def test_request_with_bytestring_body (self ):
120
139
c = HTTP11Connection ('httpbin.org' )
121
140
c ._sock = sock = DummySocket ()
Original file line number Diff line number Diff line change @@ -483,6 +483,19 @@ def data_cb(frame, *args):
483
483
assert frames [0 ].type == WindowUpdateFrame .type
484
484
assert frames [0 ].window_increment == 5535
485
485
486
+ def test_that_using_proxy_keeps_http_headers_intact (self ):
487
+ sock = DummySocket ()
488
+ c = HTTP20Connection ('www.google.com' , secure = False , proxy_host = 'localhost' )
489
+ c ._sock = sock
490
+ c .request ('GET' , '/' )
491
+ s = c .recent_stream
492
+
493
+ assert s .headers == [
494
+ (':method' , 'GET' ),
495
+ (':scheme' , 'http' ),
496
+ (':authority' , 'www.google.com' ),
497
+ (':path' , '/' ),
498
+ ]
486
499
487
500
class TestServerPush (object ):
488
501
def setup_method (self , method ):
You can’t perform that action at this time.
0 commit comments