aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-08-18 13:43:26 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-08-19 09:43:43 +0200
commit9bae97eb17ed66a33b5b988c6857ca6c9fae8e22 (patch)
tree7cd6712657c5328d5c32ac3231becc6ab83bf441 /libmproxy/protocol
parentab1549e0eff98588211346aada44549311f04938 (diff)
downloadmitmproxy-9bae97eb17ed66a33b5b988c6857ca6c9fae8e22.tar.gz
mitmproxy-9bae97eb17ed66a33b5b988c6857ca6c9fae8e22.tar.bz2
mitmproxy-9bae97eb17ed66a33b5b988c6857ca6c9fae8e22.zip
http2: fix connection preface and wrappers
Diffstat (limited to 'libmproxy/protocol')
-rw-r--r--libmproxy/protocol/http_wrappers.py36
1 files changed, 10 insertions, 26 deletions
diff --git a/libmproxy/protocol/http_wrappers.py b/libmproxy/protocol/http_wrappers.py
index ed5759ea..e41d65d6 100644
--- a/libmproxy/protocol/http_wrappers.py
+++ b/libmproxy/protocol/http_wrappers.py
@@ -247,24 +247,11 @@ class HTTPRequest(MessageMixin, semantics.Request):
include_body = include_body,
body_size_limit = body_size_limit,
)
-
- return HTTPRequest(
- req.form_in,
- req.method,
- req.scheme,
- req.host,
- req.port,
- req.path,
- req.httpversion,
- req.headers,
- req.body,
- req.timestamp_start,
- req.timestamp_end,
- )
+ return self.wrap(req)
@classmethod
def wrap(self, request):
- return HTTPRequest(
+ req = HTTPRequest(
form_in=request.form_in,
method=request.method,
scheme=request.scheme,
@@ -278,6 +265,9 @@ class HTTPRequest(MessageMixin, semantics.Request):
timestamp_end=request.timestamp_end,
form_out=(request.form_out if hasattr(request, 'form_out') else None),
)
+ if hasattr(request, 'stream_id'):
+ req.stream_id = request.stream_id
+ return req
def __hash__(self):
return id(self)
@@ -371,20 +361,11 @@ class HTTPResponse(MessageMixin, semantics.Response):
body_size_limit,
include_body=include_body
)
-
- return HTTPResponse(
- resp.httpversion,
- resp.status_code,
- resp.msg,
- resp.headers,
- resp.body,
- resp.timestamp_start,
- resp.timestamp_end,
- )
+ return self.wrap(resp)
@classmethod
def wrap(self, response):
- return HTTPResponse(
+ resp = HTTPResponse(
httpversion=response.httpversion,
status_code=response.status_code,
msg=response.msg,
@@ -393,6 +374,9 @@ class HTTPResponse(MessageMixin, semantics.Response):
timestamp_start=response.timestamp_start,
timestamp_end=response.timestamp_end,
)
+ if hasattr(response, 'stream_id'):
+ resp.stream_id = response.stream_id
+ return resp
def _refresh_cookie(self, c, delta):
"""