aboutsummaryrefslogtreecommitdiffstats
path: root/pathod/protocols/http2.py
blob: 3f45ec80cf3c226ee1ae8e06296431c60783afac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from netlib.http import http2
from .. import language


class HTTP2Protocol:

    def __init__(self, pathod_handler):
        self.pathod_handler = pathod_handler
        self.wire_protocol = http2.HTTP2Protocol(
            self.pathod_handler, is_server=True, dump_frames=self.pathod_handler.http2_framedump
        )

    def make_error_response(self, reason, body):
        return language.http2.make_error_response(reason, body)

    def read_request(self, lg=None):
        self.wire_protocol.perform_server_connection_preface()
        return self.wire_protocol.read_request(self.pathod_handler.rfile)

    def assemble(self, message):
        return self.wire_protocol.assemble(message)