summaryrefslogtreecommitdiff
path: root/lib/action.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-02-18 23:43:26 +0000
committerEvan Prodromou <evan@controlyourself.ca>2009-02-18 23:43:26 +0000
commitc9def4a8768239093823fbe34367d97f9e30d320 (patch)
tree4bacdbc1f1c3fd962b82e2e3ce53af67a9bc8db1 /lib/action.php
parent72b3c9108cc3344519a5b59188c912952a62806a (diff)
more correct handling of etags and last-modified
Diffstat (limited to 'lib/action.php')
-rw-r--r--lib/action.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/action.php b/lib/action.php
index e2d09ace2..b1e700b67 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -209,12 +209,10 @@ class Action extends HTMLOutputter // lawsuit
'src' => common_path('js/jquery.form.js')),
' ');
-
$this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/jquery.simplemodal-1.2.2.pack.js')),
' ');
-
Event::handle('EndShowJQueryScripts', array($this));
}
if (Event::handle('StartShowLaconicaScripts', array($this))) {
@@ -813,8 +811,10 @@ class Action extends HTMLOutputter // lawsuit
if ($if_modified_since) {
$ims = strtotime($if_modified_since);
if ($lm <= $ims) {
- if (!$etag ||
- $this->_hasEtag($etag, $_SERVER['HTTP_IF_NONE_MATCH'])) {
+ $if_none_match = $_SERVER['HTTP_IF_NONE_MATCH'];
+ if (!$if_none_match ||
+ !$etag ||
+ $this->_hasEtag($etag, $if_none_match)) {
header('HTTP/1.1 304 Not Modified');
// Better way to do this?
exit(0);
@@ -832,9 +832,11 @@ class Action extends HTMLOutputter // lawsuit
*
* @return boolean
*/
+
function _hasEtag($etag, $if_none_match)
{
- return ($if_none_match) && in_array($etag, explode(',', $if_none_match));
+ $etags = explode(',', $if_none_match);
+ return in_array($etag, $etags) || in_array('*', $etags);
}
/**