aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol/http.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2014-09-17 11:35:14 +1200
committerAldo Cortesi <aldo@nullcube.com>2014-09-17 11:41:42 +1200
commitd998790c2f12594e6d0edc5a98e908677b60b31f (patch)
tree2c9de7840374297d466eabf7670e87ab943e059f /libmproxy/protocol/http.py
parentb9531ac89ba70d8404444d4e2b86b94153a783c9 (diff)
downloadmitmproxy-d998790c2f12594e6d0edc5a98e908677b60b31f.tar.gz
mitmproxy-d998790c2f12594e6d0edc5a98e908677b60b31f.tar.bz2
mitmproxy-d998790c2f12594e6d0edc5a98e908677b60b31f.zip
Clean up and clarify StateObject
- Flatten the class hierarchy - get_state, load_state, from_state are public - Simplify code - Remove __eq__ and __neq__. This fundamentally changes the semantics of inherited objects in a way that's not part of the core function of the class
Diffstat (limited to 'libmproxy/protocol/http.py')
-rw-r--r--libmproxy/protocol/http.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py
index 46da7a2b..1f3d6fdf 100644
--- a/libmproxy/protocol/http.py
+++ b/libmproxy/protocol/http.py
@@ -85,7 +85,7 @@ class decoded(object):
self.o.encode(self.ce)
-class HTTPMessage(stateobject.SimpleStateObject):
+class HTTPMessage(stateobject.StateObject):
"""
Base class for HTTPRequest and HTTPResponse
"""
@@ -275,9 +275,9 @@ class HTTPRequest(HTTPMessage):
)
@classmethod
- def _from_state(cls, state):
+ def from_state(cls, state):
f = cls(None, None, None, None, None, None, None, None, None, None, None)
- f._load_state(state)
+ f.load_state(state)
return f
def __repr__(self):
@@ -626,9 +626,9 @@ class HTTPResponse(HTTPMessage):
)
@classmethod
- def _from_state(cls, state):
+ def from_state(cls, state):
f = cls(None, None, None, None, None)
- f._load_state(state)
+ f.load_state(state)
return f
def __repr__(self):
@@ -814,9 +814,9 @@ class HTTPFlow(Flow):
)
@classmethod
- def _from_state(cls, state):
+ def from_state(cls, state):
f = cls(None, None)
- f._load_state(state)
+ f.load_state(state)
return f
def __repr__(self):
@@ -1311,4 +1311,4 @@ class RequestReplayThread(threading.Thread):
self.flow.error = Error(repr(v))
self.channel.ask("error", self.flow)
finally:
- r.form_out = form_out_backup \ No newline at end of file
+ r.form_out = form_out_backup