From 59b763e9896d6f6196a894c6d57d58ef9ddd6bc6 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 15 May 2012 18:37:39 +0200 Subject: Ignore etags when displaying HTML pages This allows the html page to change (user logged in/not logged in), but still keeps etag support for content that's really going to stay the same (images, plain file content, qr codes for urls) Signed-off-by: Florian Pritz --- application/models/file_mod.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'application/models') diff --git a/application/models/file_mod.php b/application/models/file_mod.php index d977d1e70..9157f8eca 100644 --- a/application/models/file_mod.php +++ b/application/models/file_mod.php @@ -238,7 +238,6 @@ class File_mod extends CI_Model { // helps to keep traffic low when reloading $etag = $filedata["hash"]."-".$filedata["date"]; - $this->handle_etag($etag); $type = $filedata['mimetype']; @@ -255,6 +254,7 @@ class File_mod extends CI_Model { // create the qr code for /ID/ if ($mode == "qr") { + $this->handle_etag($etag); header("Content-disposition: inline; filename=\"".$id."_qr.png\"\n"); header("Content-Type: image/png\n"); passthru('qrencode -s 10 -o - '.escapeshellarg(site_url($id).'/')); @@ -263,6 +263,7 @@ class File_mod extends CI_Model { // user wants to the the plain file if ($mode == 'plain') { + $this->handle_etag($etag); rangeDownload($file, $filedata["filename"], "text/plain"); exit(); } @@ -278,6 +279,7 @@ class File_mod extends CI_Model { $filesize_too_big = filesize($file) > $this->config->item('upload_max_text_size'); if (!$can_highlight || $filesize_too_big || !$mode) { + $this->handle_etag($etag); foreach (array("X-WebKit-CSP", "X-Content-Security-Policy") as $header_name) { header("$header_name: allow 'none'; img-src *; media-src *; font-src *; style-src * 'unsafe-inline'; script-src 'none'; object-src *; frame-src 'none'; "); } -- cgit v1.2.3-24-g4f1b