]> git.mjollnir.org Git - moodle.git/commitdiff
RSS update and caching broken for some feeds MDL-7045; merged from MOODLE_17_STABLE
authorskodak <skodak>
Tue, 17 Oct 2006 07:09:18 +0000 (07:09 +0000)
committerskodak <skodak>
Tue, 17 Oct 2006 07:09:18 +0000 (07:09 +0000)
lib/magpie/README_MOODLE.txt
lib/magpie/rss_fetch.inc

index 29c59924a8053d6a61c581ec4392b3112f1bf71a..be527fa2510f4b61875942ae93b155e57295a4e9 100644 (file)
@@ -2,4 +2,17 @@ This folder is the MagpieRSS news feed client library
 http://magpierss.sourceforge.net/
 Moodle's rss_client block uses these libraries to download, parse and cache remote new feeds.
 
-Magpie version 0.72 added to Moodle 1.6dev on 20051213
\ No newline at end of file
+Magpie version 0.72 added to Moodle 1.6dev on 20051213
+
+=============================================================
+Changes - see MDL-7045:
+* ETag and Last-Modified http field names are not case sensitive anymore - should improve caching
+* Fixed some minor undefined warnings
+* Tralining newlines are stripped from ETag and Last-Modified headers (discovered by Matthew Bockol),
+  we should be sending valid headers when fetching feed updates now, yay!
+
+
+Fixes not reported upstream yet.
+
+skodak
+16 October 2006
\ No newline at end of file
index 3cd029156de9f2c27d2abbff40463008d76ee6ae..fad5c01a9541c7333bc3a2681e43f746faf0ab3a 100644 (file)
@@ -163,7 +163,7 @@ function fetch_rss ($url, $postdata=null) {
         // setup headers
         if ( $cache_status == 'STALE' ) {
             $rss = $cache->get( $cache_key );
-            if ( $rss and $rss->etag and $rss->last_modified ) {
+            if ( $rss and !empty($rss->etag) and !empty($rss->last_modified) ) { // moodle fixes
                 $request_headers['If-None-Match'] = $rss->etag;
                 $request_headers['If-Last-Modified'] = $rss->last_modified;
             }
@@ -318,14 +318,15 @@ function _response_to_rss ($resp) {
                 $field = $h;
                 $val = "";
             }
-            
-            if ( $field == 'ETag' ) {
-                $rss->etag = $val;
+// start of moodle modification
+            if ( strtolower($field) == 'etag' ) { // field names are case insensitive - sites are sending Etag, ETag, etc.
+                $rss->etag = rtrim($val);         // trailing newline problem discovered by Matthew Bockol
             }
             
-            if ( $field == 'Last-Modified' ) {
-                $rss->last_modified = $val;
+            if ( strtolower($field) == 'last-modified' ) { // field names are case insensitive
+                $rss->last_modified = rtrim($val);         // we do not want any whitespace after it
             }
+// end of moodle modification
         }
         
         return $rss;