MCPcopy
hub / github.com/benoitc/gunicorn / send_data

Method send_data

gunicorn/http2/stream.py:200–218  ·  view source on GitHub ↗

Mark data as sent. Args: data: Bytes to send end_stream: True if this completes the response Raises: HTTP2StreamError: If data cannot be sent in current state

(self, data, end_stream=False)

Source from the content-addressed store, hash-verified

198 self.response_complete = True
199
200 def send_data(self, data, end_stream=False):
201 """Mark data as sent.
202
203 Args:
204 data: Bytes to send
205 end_stream: True if this completes the response
206
207 Raises:
208 HTTP2StreamError: If data cannot be sent in current state
209 """
210 if not self.can_send:
211 raise HTTP2StreamError(
212 self.stream_id,
213 f"Cannot send data in state {self.state.name}"
214 )
215
216 if end_stream:
217 self._half_close_local()
218 self.response_complete = True
219
220 def send_trailers(self, trailers):
221 """Mark trailers as sent and close the stream.

Calls 2

_half_close_localMethod · 0.95
HTTP2StreamErrorClass · 0.85