summaryrefslogtreecommitdiffstats
path: root/application/models/file_mod.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-05-15 18:37:39 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-05-15 18:37:39 +0200
commit59b763e9896d6f6196a894c6d57d58ef9ddd6bc6 (patch)
tree1afce758eac0509d1f6c1c5bfd28eed3c54173f2 /application/models/file_mod.php
parentc5e98652982d0d04b4687f7779d2a0e4f7c936c8 (diff)
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 <bluewind@xinu.at>
Diffstat (limited to 'application/models/file_mod.php')
-rw-r--r--application/models/file_mod.php4
1 files changed, 3 insertions, 1 deletions
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'; ");
}