Skip to content

Commit

Permalink
Fix HTTP/2 window size for too large uploads
Browse files Browse the repository at this point in the history
Too large uploads will simply hang otherwise, because the window isn't increased anymore to receive the byte triggering the too large payload error.
  • Loading branch information
kelunik committed Jun 20, 2020
1 parent df6de2b commit 30063e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Driver/Http2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -1089,12 +1089,14 @@ public function handleData(int $streamId, string $data): void
}

$increment = \min(
$stream->maxBodySize - $stream->received - $stream->serverWindow,
$stream->maxBodySize + 1 - $stream->received - $stream->serverWindow,
self::MAX_INCREMENT
);

if ($increment <= 0) {
return;
}

$stream->serverWindow += $increment;

$this->writeFrame(
Expand Down

0 comments on commit 30063e2

Please sign in to comment.