aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol2/http_protocol_mock.py
blob: dd3643f69f0b53f284862c84e8fd61f8c1675c83 (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.from_protocol(HTTP1Protocol(connection), *args, **kwargs)

    @staticmethod
    def read_response(connection, *args, **kwargs):
        """
        :type connection: object
        """
        return HTTPResponse.from_protocol(HTTP1Protocol(connection), *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)