Index: feed.php =================================================================== --- kernel/rss/feed.php (revision 23248) +++ kernel/rss/feed.php (working copy) @@ -47,6 +47,8 @@ $config = eZINI::instance( 'site.ini' ); $cacheTime = intval( $config->variable( 'RSSSettings', 'CacheTime' ) ); +$lastModified = gmdate( 'D, d M Y H:i:s', time() ) . ' GMT'; + if ( $cacheTime <= 0 ) { $xmlDoc = $RSSExport->attribute( 'rss-xml' ); @@ -75,13 +77,33 @@ } else { + $lastModified = gmdate( 'D, d M Y H:i:s', $cacheFile->mtime() ) . ' GMT'; + + if( isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) + { + $ifModifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE']; + + // Internet Explorer specific + $pos = strpos($ifModifiedSince,';'); + if ( $pos !== false ) + $ifModifiedSince = substr( $ifModifiedSince, 0, $pos ); + + if( strcmp( $lastModified, $ifModifiedSince ) == 0 ) + { + header( 'HTTP/1.1 304 Not Modified' ); + header( 'Last-Modified: ' . $lastModified ); + header( 'X-Powered-By: eZ Publish' ); + eZExecution::cleanExit(); + } + } $rssContent = $cacheFile->fetchContents(); } } // Set header settings $httpCharset = eZTextCodec::httpCharset(); -header( 'Content-Type: text/xml; charset=' . $httpCharset ); +header( 'Last-Modified: ' . $lastModified ); +header( 'Content-Type: text/plain; charset=' . $httpCharset ); header( 'Content-Length: '.strlen($rssContent) ); header( 'X-Powered-By: eZ Publish' );