From 47c11bcce31b5d5287d7578a13ddcc277d19bb0a Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 27 Dec 2017 12:54:23 +0800 Subject: [PATCH] Asset.php --- Asset.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Asset.php b/Asset.php index 8f110c4c..d0fd5367 100644 --- a/Asset.php +++ b/Asset.php @@ -90,15 +90,30 @@ class Pman_Core_Asset extends Pman { header("Pragma: public"); - header('Content-Length: '. filesize($fn)); + header('Cache-Control: max-age=2592000, public'); header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000)); header('Last-Modified: '.gmdate('D, d M Y H:i:s \G\M\T', $last_modified_time)); header('Etag: '. md5($fn)); - $fh = fopen($fn,'r'); - fpassthru($fh); - fclose($fh); + if ( $supportsGzip ) { + $content = gzencode( file_get_contents($fn) , 9); + + header('Content-Encoding: gzip'); + header('Content-Length: '. strlen($content)); + echo $content; + + } else { + + + $fh = fopen($fn,'r'); + fpassthru($fh); + fclose($fh); + $content = $data; + } + + + exit; } -- 2.39.2