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

Method is_open_for_us

mitmproxy/proxy/layers/http/_http2.py:108–121  ·  view source on GitHub ↗

Check if we can write to a non-idle stream.

(self, stream_id: int)

Source from the content-addressed store, hash-verified

106 return True
107
108 def is_open_for_us(self, stream_id: int) -> bool:
109 """Check if we can write to a non-idle stream."""
110 stream = self.h2_conn.streams.get(stream_id, None)
111 if (
112 stream is not None
113 and stream.state_machine.state
114 is not h2.stream.StreamState.HALF_CLOSED_LOCAL
115 and stream.state_machine.state is not h2.stream.StreamState.CLOSED
116 and self.h2_conn.state_machine.state
117 is not h2.connection.ConnectionState.CLOSED
118 ):
119 return True
120 else:
121 return False
122
123 def _handle_event(self, event: Event) -> CommandGenerator[None]:
124 if isinstance(event, Start):

Callers 2

_handle_eventMethod · 0.95
_handle_eventMethod · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected