aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol2/http_protocol_mock.py
diff options
context:
space:
mode:
Diffstat (limited to 'libmproxy/protocol2/http_protocol_mock.py')
-rw-r--r--libmproxy/protocol2/http_protocol_mock.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/libmproxy/protocol2/http_protocol_mock.py b/libmproxy/protocol2/http_protocol_mock.py
index 5fdb9f2b..22f3dc14 100644
--- a/libmproxy/protocol2/http_protocol_mock.py
+++ b/libmproxy/protocol2/http_protocol_mock.py
@@ -1,6 +1,7 @@
"""
Temporary mock to sort out API discrepancies
"""
+from libmproxy.protocol.http_wrappers import HTTPResponse, HTTPRequest
from netlib.http.http1 import HTTP1Protocol
@@ -10,14 +11,14 @@ class HTTP1(object):
"""
:type connection: object
"""
- return HTTP1Protocol(connection).read_request(*args, **kwargs)
+ return HTTPRequest.wrap(HTTP1Protocol(connection).read_request(*args, **kwargs))
@staticmethod
def read_response(connection, *args, **kwargs):
"""
:type connection: object
"""
- return HTTP1Protocol(connection).read_response(*args, **kwargs)
+ return HTTPResponse.wrap(HTTP1Protocol(connection).read_response(*args, **kwargs))
@staticmethod
def read_http_body(connection, *args, **kwargs):
@@ -28,19 +29,13 @@ class HTTP1(object):
@staticmethod
- def _assemble_response_first_line(connection, *args, **kwargs):
- """
- :type connection: object
- """
- return HTTP1Protocol(connection)._assemble_response_first_line(*args, **kwargs)
+ def _assemble_response_first_line(*args, **kwargs):
+ return HTTP1Protocol()._assemble_response_first_line(*args, **kwargs)
@staticmethod
- def _assemble_response_headers(connection, *args, **kwargs):
- """
- :type connection: object
- """
- return HTTP1Protocol(connection)._assemble_response_headers(*args, **kwargs)
+ def _assemble_response_headers(*args, **kwargs):
+ return HTTP1Protocol()._assemble_response_headers(*args, **kwargs)
@staticmethod
@@ -48,4 +43,8 @@ class HTTP1(object):
"""
:type connection: object
"""
- return HTTP1Protocol(connection).read_http_body_chunked(*args, **kwargs) \ No newline at end of file
+ return HTTP1Protocol(connection).read_http_body_chunked(*args, **kwargs)
+
+ @staticmethod
+ def assemble(*args, **kwargs):
+ return HTTP1Protocol().assemble(*args, **kwargs) \ No newline at end of file