]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
more correct handling of etags and last-modified
authorEvan Prodromou <evan@controlyourself.ca>
Wed, 18 Feb 2009 23:43:26 +0000 (23:43 +0000)
committerEvan Prodromou <evan@controlyourself.ca>
Wed, 18 Feb 2009 23:43:26 +0000 (23:43 +0000)
lib/action.php

index e2d09ace2bc8d52822a07cfceff70dac1a1de3f7..b1e700b6709dc386390639eac5e680338b12a6e3 100644 (file)
@@ -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);
     }
 
     /**