From e9eed5e4c206e507665f5a4ff92654e969f4dd89 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Tue, 29 Sep 2015 16:23:55 +0200 Subject: --wip-- --- libmproxy/models/http.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'libmproxy/models/http.py') diff --git a/libmproxy/models/http.py b/libmproxy/models/http.py index e07dff69..3914440e 100644 --- a/libmproxy/models/http.py +++ b/libmproxy/models/http.py @@ -241,8 +241,6 @@ class HTTPRequest(MessageMixin, 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): @@ -347,8 +345,6 @@ class HTTPResponse(MessageMixin, 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): -- cgit v1.2.3 From f2097b47ce6c88e2bef0889fb7e7d52b63158082 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Sat, 30 Jan 2016 22:05:23 +0100 Subject: fix race condition during state loading PyPy and Python2.7 might process the state attributes in different order. --- libmproxy/models/http.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libmproxy/models/http.py') diff --git a/libmproxy/models/http.py b/libmproxy/models/http.py index 3914440e..a52597b4 100644 --- a/libmproxy/models/http.py +++ b/libmproxy/models/http.py @@ -11,9 +11,10 @@ from netlib.tcp import Address from .. import version, stateobject from .flow import Flow +from collections import OrderedDict class MessageMixin(stateobject.StateObject): - _stateobject_attributes = dict( + _stateobject_attributes = OrderedDict( http_version=bytes, headers=Headers, timestamp_start=float, -- cgit v1.2.3 From 6bc1755750f8a7986ab26ff28ea0e90ad0ccaacd Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Tue, 2 Feb 2016 12:32:58 +0100 Subject: add comment that explains OrderedDict use --- libmproxy/models/http.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libmproxy/models/http.py') diff --git a/libmproxy/models/http.py b/libmproxy/models/http.py index a52597b4..8a0b226d 100644 --- a/libmproxy/models/http.py +++ b/libmproxy/models/http.py @@ -14,6 +14,10 @@ from .flow import Flow from collections import OrderedDict class MessageMixin(stateobject.StateObject): + # The restoration order is important currently, e.g. because + # of .content setting .headers["content-length"] automatically. + # Using OrderedDict is the short term fix, restoring state should + # be implemented without side-effects again. _stateobject_attributes = OrderedDict( http_version=bytes, headers=Headers, -- cgit v1.2.3