From 6083ab690e67d1b08e5d10828c666a0756969a3e Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Thu, 15 Oct 2015 14:16:01 +0200 Subject: 5 secs is slow enough --- itjs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'itjs.php') diff --git a/itjs.php b/itjs.php index 332e0dc..9ef6583 100644 --- a/itjs.php +++ b/itjs.php @@ -22,7 +22,7 @@ require "itools/itools.lib"; if (EDC('slow' . it::match('\.(\w+)$', $_SERVER['PHP_SELF']))) - sleep(10); + sleep(5); $crc = $_REQUEST['c'] ?: $_REQUEST['s']; if ($crc != "-" && !$_SERVER['HTTP_CACHE_CONTROL'] && $_SERVER['HTTP_IF_NONE_MATCH'] && !it::is_devel() && !$_REQUEST['retry']) -- cgit v1.2.3 From 6314ea0e3825527f898cdc64dbc5304bafe241c0 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 27 Oct 2015 18:14:25 +0100 Subject: get file type from query params --- itjs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'itjs.php') diff --git a/itjs.php b/itjs.php index 9ef6583..80ae502 100644 --- a/itjs.php +++ b/itjs.php @@ -21,7 +21,7 @@ require "itools/itools.lib"; -if (EDC('slow' . it::match('\.(\w+)$', $_SERVER['PHP_SELF']))) +if (EDC('slow' . it::match('\.(css|js)\b', U($_GET)))) sleep(5); $crc = $_REQUEST['c'] ?: $_REQUEST['s']; -- cgit v1.2.3 From 9aab17be924ec04b7b46a971d3c9f414f6eb9bf0 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Wed, 28 Oct 2015 18:51:39 +0100 Subject: extract far future header handling for ffe.php --- itjs.php | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'itjs.php') diff --git a/itjs.php b/itjs.php index 80ae502..a1e5a0f 100644 --- a/itjs.php +++ b/itjs.php @@ -24,16 +24,11 @@ require "itools/itools.lib"; if (EDC('slow' . it::match('\.(css|js)\b', U($_GET)))) sleep(5); -$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 (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']) -- cgit v1.2.3