Added ETag on TinyMCE gzip; changed ETag format for standard pages so as to include user and login info to control caching when logged in or out
--- a/includes/clientside/tinymce/tiny_mce_gzip.php Mon May 05 20:37:33 2008 -0400
+++ b/includes/clientside/tinymce/tiny_mce_gzip.php Wed May 07 14:05:31 2008 -0400
@@ -93,6 +93,21 @@
$enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
$supportsGzip = true;
}
+
+ // Send an ETag (Enano modification 5/5/2008)
+ if ( isset($cacheKey) )
+ {
+ $etag =& $cacheKey;
+ header("ETag: \"$etag\"");
+ if ( isset($_SERVER['HTTP_IF_NONE_MATCH']) )
+ {
+ if ( "\"$etag\"" == $_SERVER['HTTP_IF_NONE_MATCH'] )
+ {
+ header('HTTP/1.1 304 Not Modified');
+ exit();
+ }
+ }
+ }
// Use cached file disk cache
if ($diskCache && $supportsGzip && file_exists($cacheFile)) {
@@ -138,7 +153,7 @@
// Restore loading functions
if ($core == "true")
$content .= "tinyMCE_GZ.end();";
-
+
// Generate GZIP'd content
if ($supportsGzip) {
if ($compress) {
--- a/index.php Mon May 05 20:37:33 2008 -0400
+++ b/index.php Wed May 07 14:05:31 2008 -0400
@@ -567,9 +567,9 @@
ob_start();
// Generate an ETag
- // format: first 10 digits of SHA1 of page name, user id in hex, page timestamp in hex
+ // format: first 10 digits of SHA1 of page name, user id in hex, user and auth levels, page timestamp in hex
$etag = substr(sha1($paths->namespace . ':' . $paths->page_id), 0, 10) . '-' .
- dechex($session->user_id) . '-' .
+ "u{$session->user_id}l{$session->user_level}a{$session->auth_level}-" .
dechex($page_timestamp);
if ( isset($_SERVER['HTTP_IF_NONE_MATCH']) )