From 99f68e432c6456e12e0e0896302da068a5fbc06d Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 29 Jun 2016 07:12:00 +0200 Subject: [PATCH] Improve HTTP headers when sending out files --- www/get.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/www/get.php b/www/get.php index 694b843..d4b70d3 100644 --- a/www/get.php +++ b/www/get.php @@ -61,10 +61,14 @@ try { $img = $rep->getImage($options); if ($config->redirect) { header('HTTP/1.0 302 Found'); + header('phancap-file: ' . $img->name); header('Expires: ' . date('r', $img->getExpiryDate($options))); header('Location: ' . $img->getUrl()); } else { - header('Content-type: ' . $img->getMimeType()); + header('HTTP/1.0 200 OK'); + header('phancap-file: ' . $img->name); + header('Content-Type: ' . $img->getMimeType()); + header('Content-Length: ' . filesize($img->getPath())); readfile($img->getPath()); } } catch (\Exception $e) { -- 2.30.2