summaryrefslogtreecommitdiff
path: root/itjs.php
diff options
context:
space:
mode:
authorChristian Helbling2015-11-16 15:20:03 +0100
committerChristian Helbling2015-11-16 15:20:03 +0100
commit2587921cdf5f9139c6f2483dddb12df27740fef5 (patch)
treeb67941b93eda2490800efafd1f5410bdd754bf16 /itjs.php
parentbabb09e211e93c6236bc19e60a4f649e573a6f4e (diff)
parent3b4aeabd9186666e025d3233f06f7458356bfc37 (diff)
downloaditools-2587921cdf5f9139c6f2483dddb12df27740fef5.tar.gz
itools-2587921cdf5f9139c6f2483dddb12df27740fef5.tar.bz2
itools-2587921cdf5f9139c6f2483dddb12df27740fef5.zip
Merge branch 'master' into cs/php7
Diffstat (limited to 'itjs.php')
-rw-r--r--itjs.php23
1 files changed, 4 insertions, 19 deletions
diff --git a/itjs.php b/itjs.php
index 332e0dc..a1e5a0f 100644
--- a/itjs.php
+++ b/itjs.php
@@ -21,19 +21,14 @@
require "itools/itools.lib";
-if (EDC('slow' . it::match('\.(\w+)$', $_SERVER['PHP_SELF'])))
- sleep(10);
-
-$crc = $_REQUEST['c'] ?: $_REQUEST['s'];
-if ($crc != "-" && !$_SERVER['HTTP_CACHE_CONTROL'] && $_SERVER['HTTP_IF_NONE_MATCH'] && !it::is_devel() && !$_REQUEST['retry'])
-{
- header("HTTP/1.0 304 Not Modified"); # client should always keep the component that fits the page it has
- exit;
-}
+if (EDC('slow' . it::match('\.(css|js)\b', U($_GET))))
+ sleep(5);
if (it::match('/server/', $_SERVER['DOCUMENT_ROOT']))
exit; # useless here. cannot write tempfiles
+itjs::far_future_headers(); # may exit
+
$files = itjs::filenames($_GET['files'] ?: it::match('/itjs/([-a-z0-9_,.]*)', $_SERVER['PHP_SELF']));
$data = itjs::filecontents($files);
$file = end($files);
@@ -82,16 +77,6 @@ else if (!it::match('\.html$', $file))
header("Content-Type: application/x-javascript; charset=$charset");
}
-if ($crc != "-")
- @header("Etag: alwaysvalid"); # we have checksums in the url. client should always keep the version he downloaded along with the html
-
-if (it::is_live() && !$_REQUEST['retry'])
-{
- $keeptime = $crc == "-" ? 0 : ($crc ? 30*86400 : 900); # long expire if checksum present
- header("Cache-Control: max-age=$keeptime, private"); # proxies should not cache since contents of same url can differ between browsers
- header("Expires: " . gmdate("D, d M Y H:i:s", time() + $keeptime). " GMT");
-}
-
$data = itjs::strip($data);
if ($_REQUEST['boot'])