? boost-637002.patch
? boost-637212.patch
? boost-638390.1.patch
? boost-638390.patch
Index: boost.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v
retrieving revision 1.3.2.2.2.5.2.251
diff -u -p -r1.3.2.2.2.5.2.251 boost.module
--- boost.module	16 Nov 2009 18:15:29 -0000	1.3.2.2.2.5.2.251
+++ boost.module	21 Nov 2009 20:11:17 -0000
@@ -188,16 +188,15 @@ function boost_init() {
   $GLOBALS['_boost_path'] = $_REQUEST['q'];
   // Make the proper filename for our query
   $GLOBALS['_boost_query'] = BOOST_CHAR;
+  $query = array();
   foreach ($_GET as $key => $val) {
     if ($key != 'q' && $key != 'destination') {
       if (!empty($val)) {
-        $GLOBALS['_boost_query'] .= (($GLOBALS['_boost_query'] == BOOST_CHAR) ? '' : '&') . $key . '=' . $val;
-      }
-      else {
-        //$GLOBALS['_boost_query'] .= (($GLOBALS['_boost_query'] == BOOST_CHAR) ? '' : '&') . $key . $val;
+        $query[$key] = $val;
       }
     }
   }
+  $GLOBALS['_boost_query'] .= str_replace('&amp;', '&', urldecode(http_build_query($query)));
 
   if (!empty($user->uid)) {
     boost_set_cookie($user);
@@ -2058,31 +2057,36 @@ function boost_cache_get($path) {
  *    2nd dimension contains all the filenames
  */
 function boost_get_all_filenames($filename, $base_dir = NULL) {
-  $names = array();
+  $namesA = array();
+  $namesB = array();
   $filenames = array();
-  $names[] = $filename;
-  $paths = explode('/', $filename);
-  $end = array_pop($paths);
   $base_dir = is_null($base_dir) ? BOOST_FILE_PATH : $base_dir;
 
-  // Generate urlencoded filename, if name contains decoded characters
-  $chars = '*:<>|?#,';
-  if (preg_match("/[" . $chars . "]/", $end)) {
-    $end = urlencode($end);
-    // '=' sign should not be encoded
-    $end = str_replace('%3D', '=', $end);
-    // '&' should not be encoded
-    $end = str_replace('%26', '&', $end);
-    // '#' should not be encoded
-    $end = str_replace('%23', '#', $end);
-    // '?' is not an issue because the first ? is converted to a _ with the default settings.
-    // If not using the default then this could be an issue. Will deal with it when that happens.
+  if (stristr($filename, '[')) {
+    $paths = explode('/', $filename);
+    $end = array_pop($paths);
+    $end = preg_replace("(\x5B[0-9]\x5D)", ']', $end);
+    $paths[] = $end;
+    $namesA[] = implode('/', $paths);
+  }
+  $namesA[] = $filename;
+
+  foreach ($namesA as $filename) {
+    $namesB[] = $filename;
+    // Generate urlencoded filename, if name contains decoded characters
+    $paths = explode('/', $filename);
+    $end = array_pop($paths);
+    //$end = str_replace('[', '%5B', $end);
+    //$end = str_replace(']', '%5D', $end);
+    $end = str_replace(',', '%2C', $end);
+    $end = str_replace(' ', '%20', $end);
     $paths[] = $end;
-    $names[] = implode('/', $paths);
+    $namesB[] = implode('/', $paths);
   }
+  $namesB = array_unique($namesB);
 
   // Generate gzip filenames
-  foreach ($names as $name) {
+  foreach ($namesB as $name) {
     $filenames['normal'][] = $name;
     if (BOOST_GZIP) {
       // Replace the correct dir with the gzip version for the given base dir.
@@ -3686,6 +3690,31 @@ if (!function_exists('file_put_contents'
   }
 }
 
+// php.net/http-build-query#90438
+if (!function_exists('http_build_query')) {
+  function http_build_query($data, $prefix='', $sep='', $key='') {
+    $ret = array();
+    foreach ((array)$data as $k => $v) {
+      if (is_int($k) && $prefix != null) {
+        $k = urlencode($prefix . $k);
+      }
+      if ((!empty($key)) || ($key === 0)) {
+        $k = $key.'['.urlencode($k).']';
+      }
+      if (is_array($v) || is_object($v)) {
+        array_push($ret, http_build_query($v, '', $sep, $k));
+      }
+      else {
+        array_push($ret, $k.'='.urlencode($v));
+      }
+    }
+    if (empty($sep)) {
+      $sep = ini_get('arg_separator.output');
+    }
+    return implode($sep, $ret);
+  }
+}
+
 //////////////////////////////////////////////////////////////////////////////
 // Crawler Code
 
