diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-07-08 21:03:04 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-07-22 15:30:11 +0200 |
commit | df1b0df39f074f1f9e8bebfee37ed73c272aa3ec (patch) | |
tree | 090bb37054e3a7123066baa21eb25a33e3e6d4fd | |
parent | c3c3d28bb118b37e5c537e7e2395698b78cf30e9 (diff) | |
download | mitmproxy-df1b0df39f074f1f9e8bebfee37ed73c272aa3ec.tar.gz mitmproxy-df1b0df39f074f1f9e8bebfee37ed73c272aa3ec.tar.bz2 mitmproxy-df1b0df39f074f1f9e8bebfee37ed73c272aa3ec.zip |
use netlib.http_semantics for generic data
-rw-r--r-- | libmproxy/protocol/http.py | 12 | ||||
-rw-r--r-- | test/test_server.py | 14 |
2 files changed, 10 insertions, 16 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index da15066b..97751b62 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -760,7 +760,7 @@ class HTTPResponse(HTTPMessage): if hasattr(rfile, "reset_timestamps"): rfile.reset_timestamps() - httpversion, code, msg, headers, content = http.read_response( + resp = http.read_response( rfile, request_method, body_size_limit, @@ -776,11 +776,11 @@ class HTTPResponse(HTTPMessage): timestamp_end = None return HTTPResponse( - httpversion, - code, - msg, - headers, - content, + resp.httpversion, + resp.status_code, + resp.msg, + resp.headers, + resp.content, timestamp_start, timestamp_end ) diff --git a/test/test_server.py b/test/test_server.py index 2805e936..91fd3971 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -765,22 +765,16 @@ class TestStreamRequest(tservers.HTTPProxTest): (self.server.urlbase, spec)) connection.send("\r\n") - httpversion, code, msg, headers, content = http.read_response( - fconn, "GET", None, include_body=False) + resp = http.read_response(fconn, "GET", None, include_body=False) - assert headers["Transfer-Encoding"][0] == 'chunked' - assert code == 200 + assert resp.headers["Transfer-Encoding"][0] == 'chunked' + assert resp.status_code == 200 chunks = list( content for _, content, _ in http.read_http_body_chunked( - fconn, - headers, - None, - "GET", - 200, - False)) + fconn, resp.headers, None, "GET", 200, False)) assert chunks == ["this", "isatest", ""] connection.close() |