# HG changeset patch # User Dan # Date 1210183531 14400 # Node ID 0a2c1ce32d91bf59ac232111ec406c849b91b342 # Parent 506e8e3e2af2aec2fc9eff33c55942f3de66e9e8 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 diff -r 506e8e3e2af2 -r 0a2c1ce32d91 includes/clientside/tinymce/tiny_mce_gzip.php --- 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) { diff -r 506e8e3e2af2 -r 0a2c1ce32d91 index.php --- 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']) )