diff --git a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php index 490726dadf799..8e2e0f4bb56d6 100644 --- a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php +++ b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php @@ -252,6 +252,7 @@ public function prepare(Request $request) if ($start <= $end) { if ($start < 0 || $end > $fileSize - 1) { $this->setStatusCode(416); + $this->headers->set('Content-Range', sprintf('bytes */%s', $fileSize)); } elseif ($start !== 0 || $end !== $fileSize - 1) { $this->maxlen = $end < $fileSize ? $end - $start + 1 : -1; $this->offset = $start; diff --git a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php index 4c055ff8a17f8..8f6b0e7424c91 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php @@ -211,7 +211,7 @@ public function testInvalidRequests($requestRange) $response->sendContent(); $this->assertEquals(416, $response->getStatusCode()); - #$this->assertEquals('', $response->headers->get('Content-Range')); + $this->assertEquals('bytes */35', $response->headers->get('Content-Range')); } public function provideInvalidRanges()
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: