diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-06-01 09:58:01 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-06-01 09:58:01 +1200 |
commit | a061e4587772f4a87eb43d84f2ed358f7cc98fbd (patch) | |
tree | 1aba05c9d0d6f654fe946897dcb8b5d9127a3de2 /netlib/http/message.py | |
parent | 06703542037d1c84b0dcb60c6d1c500a0d189e93 (diff) | |
parent | a7abf8b731658b4e7ed8705f7a94a6a62f08d51d (diff) | |
download | mitmproxy-a061e4587772f4a87eb43d84f2ed358f7cc98fbd.tar.gz mitmproxy-a061e4587772f4a87eb43d84f2ed358f7cc98fbd.tar.bz2 mitmproxy-a061e4587772f4a87eb43d84f2ed358f7cc98fbd.zip |
Merge branch 'master' of github.com:cortesi/mitmproxy
Diffstat (limited to 'netlib/http/message.py')
-rw-r--r-- | netlib/http/message.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/netlib/http/message.py b/netlib/http/message.py index 13d401a7..d9654f26 100644 --- a/netlib/http/message.py +++ b/netlib/http/message.py @@ -4,9 +4,8 @@ import warnings import six -from .headers import Headers -from .. import encoding, utils -from ..utils import always_bytes +from .. import encoding, utils, basetypes +from . import headers if six.PY2: # pragma: no cover def _native(x): @@ -20,10 +19,10 @@ else: return x.decode("utf-8", "surrogateescape") def _always_bytes(x): - return always_bytes(x, "utf-8", "surrogateescape") + return utils.always_bytes(x, "utf-8", "surrogateescape") -class MessageData(utils.Serializable): +class MessageData(basetypes.Serializable): def __eq__(self, other): if isinstance(other, MessageData): return self.__dict__ == other.__dict__ @@ -38,7 +37,7 @@ class MessageData(utils.Serializable): def set_state(self, state): for k, v in state.items(): if k == "headers": - v = Headers.from_state(v) + v = headers.Headers.from_state(v) setattr(self, k, v) def get_state(self): @@ -48,11 +47,11 @@ class MessageData(utils.Serializable): @classmethod def from_state(cls, state): - state["headers"] = Headers.from_state(state["headers"]) + state["headers"] = headers.Headers.from_state(state["headers"]) return cls(**state) -class Message(utils.Serializable): +class Message(basetypes.Serializable): def __eq__(self, other): if isinstance(other, Message): return self.data == other.data @@ -72,7 +71,7 @@ class Message(utils.Serializable): @classmethod def from_state(cls, state): - state["headers"] = Headers.from_state(state["headers"]) + state["headers"] = headers.Headers.from_state(state["headers"]) return cls(**state) @property |