From 9fd79d4e8a836769dceea5f5c13630ec256740ce Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Sun, 17 Nov 2019 14:20:57 +0100 Subject: [PATCH] Drop content lenght headers; closes #1342 #1343 #1347 #1348 --- galette/includes/main.inc.php | 1 + galette/includes/routes/management.routes.php | 3 +-- galette/includes/routes/members.routes.php | 3 +-- galette/lib/Galette/Core/Picture.php | 1 - 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/galette/includes/main.inc.php b/galette/includes/main.inc.php index cd45e0610..15ec89ffe 100644 --- a/galette/includes/main.inc.php +++ b/galette/includes/main.inc.php @@ -87,6 +87,7 @@ if ($needs_update) { 'settings' => [ 'determineRouteBeforeAppMiddleware' => true, 'displayErrorDetails' => (GALETTE_MODE === 'DEV'), + 'addContentLengthHeader' => false, // monolog settings 'logger' => [ 'name' => 'galette', diff --git a/galette/includes/routes/management.routes.php b/galette/includes/routes/management.routes.php index f791dbd52..a2f6b369a 100644 --- a/galette/includes/routes/management.routes.php +++ b/galette/includes/routes/management.routes.php @@ -1369,8 +1369,7 @@ $app->get( ->withHeader('Content-Transfer-Encoding', 'binary') ->withHeader('Expires', '0') ->withHeader('Cache-Control', 'must-revalidate') - ->withHeader('Pragma', 'public') - ->withHeader('Content-Length', filesize($filepath)); + ->withHeader('Pragma', 'public'); $stream = fopen('php://memory', 'r+'); fwrite($stream, file_get_contents($filepath)); diff --git a/galette/includes/routes/members.routes.php b/galette/includes/routes/members.routes.php index 22105ea42..bdf9aa3a7 100644 --- a/galette/includes/routes/members.routes.php +++ b/galette/includes/routes/members.routes.php @@ -350,8 +350,7 @@ $app->get( ->withHeader('Content-Transfer-Encoding', 'binary') ->withHeader('Expires', '0') ->withHeader('Cache-Control', 'must-revalidate') - ->withHeader('Pragma', 'public') - ->withHeader('Content-Length', filesize($filepath)); + ->withHeader('Pragma', 'public'); $stream = fopen('php://memory', 'r+'); fwrite($stream, file_get_contents($filepath)); diff --git a/galette/lib/Galette/Core/Picture.php b/galette/lib/Galette/Core/Picture.php index 06d88d46c..ce9959c8f 100644 --- a/galette/lib/Galette/Core/Picture.php +++ b/galette/lib/Galette/Core/Picture.php @@ -297,7 +297,6 @@ class Picture implements FileInterface public function display() { header('Content-type: '.$this->mime); - header('Content-Length: ' . filesize($this->file_path)); ob_clean(); flush(); readfile($this->file_path); -- 2.39.2