diff options
author | Aldo Cortesi <aldo@corte.si> | 2016-05-31 16:34:28 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2016-05-31 16:34:28 +1200 |
commit | 2f526393d29b6a03e43d1f6240175b4dfb13dc7d (patch) | |
tree | 5139eb975211295b65da9cc9736d92cd1ac0f756 /netlib/http/http2/connections.py | |
parent | d98582664d8f234fe6a2c805f02d47686243379f (diff) | |
parent | 4de4223b2ddb4417be0d6a2fa0556d531a494091 (diff) | |
download | mitmproxy-2f526393d29b6a03e43d1f6240175b4dfb13dc7d.tar.gz mitmproxy-2f526393d29b6a03e43d1f6240175b4dfb13dc7d.tar.bz2 mitmproxy-2f526393d29b6a03e43d1f6240175b4dfb13dc7d.zip |
Merge pull request #1178 from cortesi/pseudohdrs
Improve handling of HTTP2 pseudo-headers
Diffstat (limited to 'netlib/http/http2/connections.py')
-rw-r--r-- | netlib/http/http2/connections.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/netlib/http/http2/connections.py b/netlib/http/http2/connections.py index b988d6ef..6b91f2ff 100644 --- a/netlib/http/http2/connections.py +++ b/netlib/http/http2/connections.py @@ -98,6 +98,11 @@ class HTTP2Protocol(object): method = headers.get(':method', 'GET') scheme = headers.get(':scheme', 'https') path = headers.get(':path', '/') + + headers.clear(":method") + headers.clear(":scheme") + headers.clear(":path") + host = None port = None @@ -202,12 +207,9 @@ class HTTP2Protocol(object): if ':authority' not in headers: headers.insert(0, b':authority', authority.encode('ascii')) - if ':scheme' not in headers: - headers.insert(0, b':scheme', request.scheme.encode('ascii')) - if ':path' not in headers: - headers.insert(0, b':path', request.path.encode('ascii')) - if ':method' not in headers: - headers.insert(0, b':method', request.method.encode('ascii')) + headers.insert(0, b':scheme', request.scheme.encode('ascii')) + headers.insert(0, b':path', request.path.encode('ascii')) + headers.insert(0, b':method', request.method.encode('ascii')) if hasattr(request, 'stream_id'): stream_id = request.stream_id |