Skip to content

Commit

Permalink
Wait for prior write to complete before marking body as complete
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Jan 12, 2025
1 parent e472e56 commit e5ed4e6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Connection/Internal/Http2ConnectionProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1035,12 +1035,16 @@ public function request(Request $request, Cancellation $cancellation, Stream $st
return $responseFuture->await();
}

// Wait for prior write to complete if we've buffered too much of the request body.
if (\strlen($http2stream->requestBodyBuffer) >= self::DEFAULT_MAX_FRAME_SIZE) {
$writeFuture->await($cancellation);
}

if ($chunk === null) {
// Don't move this out of the loop, this needs to be set before calling writeData
$http2stream->requestBodyCompletion->complete();
}

$writeFuture->await($cancellation);
$writeFuture = $this->writeData($http2stream, $buffer);
events()->requestBodyProgress($request, $stream);
$buffer = $chunk;
Expand Down

0 comments on commit e5ed4e6

Please sign in to comment.