Skip to content

Commit

Permalink
#277 - Safari sends an initial 0-1 range request to check if range re…
Browse files Browse the repository at this point in the history
…quests are working. If the response contains Content-Length this request fails.
  • Loading branch information
johanjanssens committed Nov 10, 2021
1 parent 4fa6e4b commit 7469525
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,12 @@ public function send(KDispatcherResponseInterface $response)
$size = $this->getFileSize($response);

$response->setStatus(KHttpResponse::PARTIAL_CONTENT);
$response->headers->set('Content-Length', $range - $offset + 1);
$response->headers->set('Content-Range', sprintf('bytes %s-%s/%s', $offset, $range, $size));

//Safari sends an initial 0-1 range request, which fails if a Content-Length is provided in response on HTTP2
if(($range - $offset) > 1) {
$response->headers->set('Content-Length', $range - $offset);
}
}

if($response->isError())
Expand Down

0 comments on commit 7469525

Please sign in to comment.