--- weblib.php.without-conditional-get 2007-08-21 14:10:15.000000000 +0200 +++ weblib.php 2007-08-21 17:40:15.000000000 +0200 @@ -2792,14 +2792,7 @@ global $CFG, $THEME; - // Fix for IE6 caching - we don't want the filemtime('styles.php'), instead use now. - $lastmodified = time(); - - header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $lastmodified) . ' GMT'); - header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $lifetime) . ' GMT'); - header('Cache-Control: max-age='. $lifetime); - header('Pragma: '); - header('Content-type: text/css'); // Correct MIME type + ob_start(); $DEFAULT_SHEET_LIST = array('styles_layout', 'styles_fonts', 'styles_color'); @@ -2850,6 +2843,24 @@ } } +/// Respond only with a 304 if the stylesheets have not been modified +/// since they last were fetched + $modifiedtext = gmdate('D, d M Y H:i:s', $lastmodified) . ' GMT'; + $etagtext = "\"$lastmodified\""; + + if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $modifiedtext && $_SERVER['HTTP_IF_NONE_MATCH'] == $etagtext) { + ob_end_clean(); + header('HTTP/1.1 304 Not Modified'); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $lifetime) . ' GMT'); + exit(); + } + else { + header('Last-Modified: ' . $modifiedtext); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $lifetime) . ' GMT'); + header('Cache-Control: max-age='. $lifetime); + header('ETag: ' . $etagtext); + header('Content-type: text/css'); // Correct MIME type + } /// Get a list of all the files we want to include $files = array(); @@ -2941,6 +2952,8 @@ } } + ob_end_flush(); + return $CFG->themewww.'/'.$themename; // Only to help old themes (1.4 and earlier) }