Index: boost/htaccess/boosted.txt =================================================================== --- boost/htaccess/boosted.txt (revision 1962) +++ boost/htaccess/boosted.txt (working copy) @@ -130,6 +130,14 @@ RewriteCond %{HTTP_COOKIE} !DRUPAL_UID RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0%{REQUEST_URI}.html -f RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1.html [L] + RewriteCond %{REQUEST_METHOD} ^GET$ + RewriteCond %{REQUEST_URI} !^/cache + RewriteCond %{REQUEST_URI} !^/user/login + RewriteCond %{REQUEST_URI} !^/admin + RewriteCond %{QUERY_STRING} !^$ + RewriteCond %{HTTP_COOKIE} !DRUPAL_UID + RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}.html -f + RewriteRule ^(.*)$ cache/%{SERVER_NAME}/$1_%{QUERY_STRING}.html [L] # BOOST END # Rewrite current-style URLs of the form 'index.php?q=x'. Index: boost/boost.api.inc =================================================================== --- boost/boost.api.inc (revision 1962) +++ boost/boost.api.inc (working copy) @@ -176,6 +176,9 @@ if (empty($path) || $path == BOOST_FRONTPAGE) { $path = 'index'; // special handling for Drupal's front page } + if ($GLOBALS['_boost_query']) { + $path .= $GLOBALS['_boost_query']; + } // Under no circumstances should the incoming path contain '..' or null // bytes; we also limit the maximum directory nesting depth of the path @@ -185,7 +188,7 @@ } // Convert any other undesirable characters in the path to underscores - $path = preg_replace('@[^/a-z0-9_-]@i', '_', $path); + $path = preg_replace('@[^/a-z0-9_\-&=,\.]@i', '_', $path); return boost_cache_directory() . '/' . $path . BOOST_FILE_EXTENSION; } Index: boost/boost.module =================================================================== --- boost/boost.module (revision 1962) +++ boost/boost.module (working copy) @@ -104,14 +104,24 @@ // We only support GET requests by anonymous visitors: global $user; if (empty($user->uid) && $_SERVER['REQUEST_METHOD'] == 'GET') { + // Make the proper filename for our query + $fname = ''; + foreach ($_GET as $key => $val) { + if ($key != 'q') { + $fname .= (empty($fname) ? '' : '&') . $key . '=' . $val; + } + } + $fname = (empty($fname) ? '' : '_' . $fname); + // Make sure no query string (in addition to ?q=) was set, and that // the page is cacheable according to our current configuration: - if (count($_GET) == 1 && boost_is_cacheable($_GET['q'])) { + if (boost_is_cacheable($_GET['q'])) { // In the event of errors such as drupal_not_found(), GET['q'] is // changed before _boost_ob_handler() is called. Apache is going to // look in the cache for the original path, however, so we need to // preserve it. $GLOBALS['_boost_path'] = $_GET['q']; + $GLOBALS['_boost_query'] = $fname; ob_start('_boost_ob_handler'); } } @@ -157,22 +167,15 @@ // session messages have actually been set during this page request: global $user; if (empty($user->uid) && ($messages = drupal_set_message())) { - - // Check that the page we're redirecting to really necessitates - // special handling, i.e. it doesn't have a query string: - extract(parse_url($destination)); - $path = ($path == base_path() ? '' : substr($path, strlen(base_path()))); - if (empty($query)) { - // FIXME: call any remaining exit hooks since we're about to terminate? - - // If no query string was previously set, add one just to ensure we - // don't serve a static copy of the page we're redirecting to, which - // would prevent the session messages from showing up: - $destination = url($path, 't=' . time(), $fragment, TRUE); - - // Do what drupal_goto() would do if we were to return to it: - exit(header('Location: ' . $destination)); - } + // FIXME: call any remaining exit hooks since we're about to terminate? + + $query_parts = parse_url($destination); + $query_parts['path'] = ($query_parts['path'] == base_path() ? '' : substr($query_parts['path'], strlen(base_path()))); + // Add a nocache parameter to query. Such pages will never be cached + $query_parts['query'] .= (empty($query_parts['query']) ? '' : '&') . 'nocache=1'; + $destination = url($query_parts['path'], $query_parts); + // Do what drupal_goto() would do if we were to return to it: + exit(header('Location: ' . $destination)); } } }