aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol2/http_protocol_mock.py
blob: 22f3dc1470490e40acc3097ff83f6f39228f278d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Temporary mock to sort out API discrepancies
"""
from libmproxy.protocol.http_wrappers import HTTPResponse, HTTPRequest
from netlib.http.http1 import HTTP1Protocol


class HTTP1(object):
    @staticmethod
    def read_request(connection, *args, **kwargs):
        """
        :type connection: object
        """
        return HTTPRequest.wrap(HTTP1Protocol(connection).read_request(*args, **kwargs))

    @staticmethod
    def read_response(connection, *args, **kwargs):
        """
        :type connection: object
        """
        return HTTPResponse.wrap(HTTP1Protocol(connection).read_response(*args, **kwargs))

    @staticmethod
    def read_http_body(connection, *args, **kwargs):
        """
        :type connection: object
        """
        return HTTP1Protocol(connection).read_http_body(*args, **kwargs)


    @staticmethod
    def _assemble_response_first_line(*args, **kwargs):
        return HTTP1Protocol()._assemble_response_first_line(*args, **kwargs)


    @staticmethod
    def _assemble_response_headers(*args, **kwargs):
        return HTTP1Protocol()._assemble_response_headers(*args, **kwargs)


    @staticmethod
    def read_http_body_chunked(connection, *args, **kwargs):
        """
        :type connection: object
        """
        return HTTP1Protocol(connection).read_http_body_chunked(*args, **kwargs)

    @staticmethod
    def assemble(*args, **kwargs):
        return HTTP1Protocol().assemble(*args, **kwargs)