MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / protocol_error

Method protocol_error

mitmproxy/proxy/layers/http/_http2.py:314–322  ·  view source on GitHub ↗
(
        self,
        message: str,
        error_code: int = h2.errors.ErrorCodes.PROTOCOL_ERROR,
    )

Source from the content-addressed store, hash-verified

312 return False
313
314 def protocol_error(
315 self,
316 message: str,
317 error_code: int = h2.errors.ErrorCodes.PROTOCOL_ERROR,
318 ) -> CommandGenerator[None]:
319 yield Log(f"{human.format_address(self.conn.peername)}: {message}")
320 self.h2_conn.close_connection(error_code, message.encode())
321 yield SendData(self.conn, self.h2_conn.data_to_send())
322 yield from self.close_connection(message)
323
324 def close_connection(self, msg: str) -> CommandGenerator[None]:
325 yield CloseConnection(self.conn)

Callers 3

handle_h2_eventMethod · 0.95
handle_h2_eventMethod · 0.80
handle_h2_eventMethod · 0.80

Calls 4

close_connectionMethod · 0.95
SendDataClass · 0.85
LogClass · 0.50
encodeMethod · 0.45

Tested by

no test coverage detected