Skip to content
Snippets Groups Projects
Commit 33452a61 authored by catch's avatar catch
Browse files

Don't set content-length header for BinaryFileResponse

parent 577b6900
No related branches found
No related tags found
1 merge request!6453Resolve #3419024 "Binary file response"
......@@ -3,6 +3,7 @@
namespace Drupal\Core\StackMiddleware;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
......@@ -26,6 +27,11 @@ public function __construct(
*/
public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE): Response {
$response = $this->httpKernel->handle($request, $type, $catch);
// Don't set a content-length header for files because they may be gzipped
// by the server.
if ($response instanceof BinaryFileResponse) {
return $response;
}
if ($response->isInformational() || $response->isEmpty()) {
return $response;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment