Esempio n. 1
0
    def read_request(self):
        self.request_data_finished.wait()

        if self.zombie:  # pragma: no cover
            raise exceptions.Http2ProtocolException("Zombie Stream")

        data = []
        while self.request_data_queue.qsize() > 0:
            data.append(self.request_data_queue.get())
        data = b"".join(data)

        first_line_format, method, scheme, host, port, path = http2.parse_headers(self.request_headers)

        return models.HTTPRequest(
            first_line_format,
            method,
            scheme,
            host,
            port,
            path,
            b"HTTP/2.0",
            self.request_headers,
            data,
            timestamp_start=self.timestamp_start,
            timestamp_end=self.timestamp_end,
        )
Esempio n. 2
0
    def read_request(self):
        self.request_data_finished.wait()

        if self.zombie:  # pragma: no cover
            raise exceptions.Http2ProtocolException("Zombie Stream")

        data = []
        while self.request_data_queue.qsize() > 0:
            data.append(self.request_data_queue.get())
        data = b"".join(data)

        first_line_format, method, scheme, host, port, path = http2.parse_headers(self.request_headers)

        return models.HTTPRequest(
            first_line_format,
            method,
            scheme,
            host,
            port,
            path,
            b"HTTP/2.0",
            self.request_headers,
            data,
            timestamp_start=self.timestamp_start,
            timestamp_end=self.timestamp_end,
        )
Esempio n. 3
0
 def read_request_headers(self):
     self.request_arrived.wait()
     self.raise_zombie()
     first_line_format, method, scheme, host, port, path = http2.parse_headers(
         self.request_headers)
     return models.HTTPRequest(
         first_line_format,
         method,
         scheme,
         host,
         port,
         path,
         b"HTTP/2.0",
         self.request_headers,
         None,
         timestamp_start=self.timestamp_start,
         timestamp_end=self.timestamp_end,
     )
Esempio n. 4
0
    def read_request(
        self,
        __rfile,
        include_body=True,
        body_size_limit=None,
        allow_empty=False,
    ):
        if body_size_limit is not None:
            raise NotImplementedError()

        self.perform_connection_preface()

        timestamp_start = time.time()
        if hasattr(self.tcp_handler.rfile, "reset_timestamps"):
            self.tcp_handler.rfile.reset_timestamps()

        stream_id, headers, body = self._receive_transmission(
            include_body=include_body,
        )

        if hasattr(self.tcp_handler.rfile, "first_byte_timestamp"):
            # more accurate timestamp_start
            timestamp_start = self.tcp_handler.rfile.first_byte_timestamp

        timestamp_end = time.time()

        first_line_format, method, scheme, host, port, path = http2.parse_headers(headers)

        request = netlib.http.request.Request(
            first_line_format,
            method,
            scheme,
            host,
            port,
            path,
            b"HTTP/2.0",
            headers,
            body,
            timestamp_start,
            timestamp_end,
        )
        request.stream_id = stream_id

        return request
Esempio n. 5
0
    def read_request(
        self,
        __rfile,
        include_body=True,
        body_size_limit=None,
        allow_empty=False,
    ):
        if body_size_limit is not None:
            raise NotImplementedError()

        self.perform_connection_preface()

        timestamp_start = time.time()
        if hasattr(self.tcp_handler.rfile, "reset_timestamps"):
            self.tcp_handler.rfile.reset_timestamps()

        stream_id, headers, body = self._receive_transmission(
            include_body=include_body, )

        if hasattr(self.tcp_handler.rfile, "first_byte_timestamp"):
            # more accurate timestamp_start
            timestamp_start = self.tcp_handler.rfile.first_byte_timestamp

        timestamp_end = time.time()

        first_line_format, method, scheme, host, port, path = http2.parse_headers(
            headers)

        request = netlib.http.request.Request(
            first_line_format,
            method,
            scheme,
            host,
            port,
            path,
            b"HTTP/2.0",
            headers,
            body,
            timestamp_start,
            timestamp_end,
        )
        request.stream_id = stream_id

        return request
Esempio n. 6
0
    def read_request(self):
        self.request_data_finished.wait()

        data = []
        while self.request_data_queue.qsize() > 0:
            data.append(self.request_data_queue.get())
        data = b"".join(data)

        first_line_format, method, scheme, host, port, path = http2.parse_headers(self.request_headers)

        return models.HTTPRequest(
            first_line_format,
            method,
            scheme,
            host,
            port,
            path,
            b"HTTP/2.0",
            self.request_headers,
            data,
            timestamp_start=self.timestamp_start,
            timestamp_end=self.timestamp_end,
        )
Esempio n. 7
0
    def read_request(self):
        self.request_data_finished.wait()

        data = []
        while self.request_data_queue.qsize() > 0:
            data.append(self.request_data_queue.get())
        data = b"".join(data)

        first_line_format, method, scheme, host, port, path = http2.parse_headers(
            self.request_headers)

        return models.HTTPRequest(
            first_line_format,
            method,
            scheme,
            host,
            port,
            path,
            b"HTTP/2.0",
            self.request_headers,
            data,
            timestamp_start=self.timestamp_start,
            timestamp_end=self.timestamp_end,
        )