コード例 #1
0
ファイル: http2.py プロジェクト: Splat/mitmproxy
    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,
        )
コード例 #2
0
ファイル: http2.py プロジェクト: tigerqiu712/mitmproxy
    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,
        )
コード例 #3
0
ファイル: http2.py プロジェクト: skywind0218/mitmproxy
 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,
     )
コード例 #4
0
ファイル: http2.py プロジェクト: Angelcold/mitmproxy
    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
コード例 #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
コード例 #6
0
ファイル: http2.py プロジェクト: lordillusions/mitmproxy
    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,
        )
コード例 #7
0
ファイル: http2.py プロジェクト: timmc/mitmproxy
    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,
        )