From 35a6d6e7f67f8253a32a670a4629b530d7758650 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Sat, 2 Apr 2016 22:54:46 +0200 Subject: [PATCH] response.msg -> response.reason --- examples/har_extractor.py | 2 +- mitmproxy/models/flow.py | 1 - netlib/http/response.py | 10 ---------- pathod/pathoc.py | 2 +- test/netlib/http/http2/test_connections.py | 4 ++-- 5 files changed, 4 insertions(+), 15 deletions(-) diff --git a/examples/har_extractor.py b/examples/har_extractor.py index 15e1ef301..371e2282d 100644 --- a/examples/har_extractor.py +++ b/examples/har_extractor.py @@ -143,7 +143,7 @@ def response(context, flow): }, "response": { "status": flow.response.status_code, - "statusText": flow.response.msg, + "statusText": flow.response.reason, "httpVersion": flow.response.http_version, "cookies": format_cookies(flow.response.cookies), "headers": format_headers(flow.response.headers), diff --git a/mitmproxy/models/flow.py b/mitmproxy/models/flow.py index 95fb2b697..45b3b5e05 100644 --- a/mitmproxy/models/flow.py +++ b/mitmproxy/models/flow.py @@ -28,7 +28,6 @@ class Error(stateobject.StateObject): @type msg: str @type timestamp: float """ - self.flow = None # will usually be set by the flow backref mixin self.msg = msg self.timestamp = timestamp or utils.timestamp() diff --git a/netlib/http/response.py b/netlib/http/response.py index 8af3c0412..5fce4d79d 100644 --- a/netlib/http/response.py +++ b/netlib/http/response.py @@ -103,13 +103,3 @@ class Response(Message): def set_cookies(self, odict): # pragma: no cover warnings.warn(".set_cookies is deprecated, use .cookies instead.", DeprecationWarning) self.cookies = odict - - @property - def msg(self): # pragma: no cover - warnings.warn(".msg is deprecated, use .reason instead.", DeprecationWarning) - return self.reason - - @msg.setter - def msg(self, reason): # pragma: no cover - warnings.warn(".msg is deprecated, use .reason instead.", DeprecationWarning) - self.reason = reason diff --git a/pathod/pathoc.py b/pathod/pathoc.py index 0e6d3ca74..f55a2eda5 100644 --- a/pathod/pathoc.py +++ b/pathod/pathoc.py @@ -425,7 +425,7 @@ class Pathoc(tcp.TCPClient): finally: if resp: lg("<< %s %s: %s bytes" % ( - resp.status_code, utils.xrepr(resp.msg), len(resp.content) + resp.status_code, utils.xrepr(resp.reason), len(resp.content) )) if resp.status_code in self.ignorecodes: lg.suppress() diff --git a/test/netlib/http/http2/test_connections.py b/test/netlib/http/http2/test_connections.py index c067d487c..0a142afad 100644 --- a/test/netlib/http/http2/test_connections.py +++ b/test/netlib/http/http2/test_connections.py @@ -417,7 +417,7 @@ class TestReadResponse(tservers.ServerTestBase): assert resp.http_version == "HTTP/2.0" assert resp.status_code == 200 - assert resp.msg == '' + assert resp.reason == '' assert resp.headers.fields == [[b':status', b'200'], [b'etag', b'foobar']] assert resp.content == b'foobar' assert resp.timestamp_end @@ -444,7 +444,7 @@ class TestReadEmptyResponse(tservers.ServerTestBase): assert resp.stream_id == 42 assert resp.http_version == "HTTP/2.0" assert resp.status_code == 200 - assert resp.msg == '' + assert resp.reason == '' assert resp.headers.fields == [[b':status', b'200'], [b'etag', b'foobar']] assert resp.content == b''