Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/httpcore2/httpcore2/_async/http2.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,11 @@ async def _send_stream_data(self, request: Request, stream_id: int, data: bytes)
"""
Send a single chunk of data in one or more data frames.
"""
while data:
position = 0
while position < len(data):
max_flow = await self._wait_for_outgoing_flow(request, stream_id)
chunk_size = min(len(data), max_flow)
chunk, data = data[:chunk_size], data[chunk_size:]
chunk = data[position : position + max_flow]
position += len(chunk)
self._h2_state.send_data(stream_id, chunk)
await self._write_outgoing_data(request)

Expand Down
7 changes: 4 additions & 3 deletions src/httpcore2/httpcore2/_sync/http2.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,11 @@ def _send_stream_data(self, request: Request, stream_id: int, data: bytes) -> No
"""
Send a single chunk of data in one or more data frames.
"""
while data:
position = 0
Comment thread
Kludex marked this conversation as resolved.
while position < len(data):
max_flow = self._wait_for_outgoing_flow(request, stream_id)
chunk_size = min(len(data), max_flow)
chunk, data = data[:chunk_size], data[chunk_size:]
chunk = data[position : position + max_flow]
position += len(chunk)
self._h2_state.send_data(stream_id, chunk)
self._write_outgoing_data(request)

Expand Down
Loading