? boost-512298.patch
Index: boost.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.admin.inc,v
retrieving revision 1.1.2.1.2.3.2.42
diff -u -p -r1.1.2.1.2.3.2.42 boost.admin.inc
--- boost.admin.inc	29 Jul 2009 07:21:09 -0000	1.1.2.1.2.3.2.42
+++ boost.admin.inc	29 Jul 2009 08:21:56 -0000
@@ -207,6 +207,12 @@ function boost_admin_boost_performace_pa
       '#default_value' => BOOST_CACHE_QUERY,
       '#description'   => t('Boost will cache pages that end with ?page=1 among others.'),
     );
+   $form['advanced']['boost_cache_html'] = array(
+     '#type'          => 'checkbox',
+     '#title'         => t('Cache html documents/pages'),
+     '#default_value' => BOOST_CACHE_HTML,
+     '#description'   => t('Boost will cache most drupal pages.'),
+   );
    $form['advanced']['boost_cache_xml'] = array(
      '#type'          => 'checkbox',
      '#title'         => t('Cache .xml & /feed'),
@@ -225,6 +231,12 @@ function boost_admin_boost_performace_pa
      '#default_value' => BOOST_CACHE_JS,
      '#description'   => t('Boost will cache javascript files.'),
    );
+   $form['advanced']['boost_cache_json'] = array(
+     '#type'          => 'checkbox',
+     '#title'         => t('Cache ajax/json'),
+     '#default_value' => BOOST_CACHE_JSON,
+     '#description'   => t('Boost will cache ajax/json responces.'),
+   );
   $form['advanced']['boost_only_ascii_path'] = array(
     '#type'          => 'checkbox',
     '#title'         => t('Only allow ASCII characters in path'),
@@ -464,11 +476,11 @@ function boost_admin_generate_htaccess($
   RewriteCond %{REQUEST_URI} (^$drupal_subdir(admin|cache|misc|modules|sites|system|themes))|(/(comment/reply|user|user/(login|password|register))$) [OR]
   RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
   RewriteCond %{HTTPS} on
-  RewriteRule .* - [S=9]
+  RewriteRule .* - [S=11]
 
   # GZIP
   RewriteCond %{HTTP:Accept-encoding} !gzip
-  RewriteRule .* - [S=4]
+  RewriteRule .* - [S=5]
 
   RewriteCond $document_root$drupal_subdir/$cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}$html$gz -s
   RewriteRule .* $cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}$html$gz [L,T=text/html]
@@ -476,6 +488,8 @@ function boost_admin_generate_htaccess($
   RewriteRule .* $cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}$xml$gz [L,T=text/xml]
   RewriteCond $document_root$drupal_subdir/$cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_$css$gz -s
   RewriteRule .* $cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_$css$gz [L,QSA,T=text/css]
+  RewriteCond $document_root$drupal_subdir/$cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}$js$gz -s
+  RewriteRule .* $cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}$js$gz [L,T=text/javascript]
   RewriteCond $document_root$drupal_subdir/$cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_$js$gz -s
   RewriteRule .* $cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_$js$gz [L,QSA,T=text/javascript]
 
@@ -486,6 +500,8 @@ function boost_admin_generate_htaccess($
   RewriteRule .* $cache_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}$xml [L,T=text/xml]
   RewriteCond $document_root$drupal_subdir/$cache_dir/$server_name%{REQUEST_URI}_$css -s
   RewriteRule .* $cache_dir/$server_name%{REQUEST_URI}_$css [L,QSA,T=text/css]
+  RewriteCond $document_root$drupal_subdir/$cache_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}$js -s
+  RewriteRule .* $cache_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}$js [L,T=text/javascript]
   RewriteCond $document_root$drupal_subdir/$cache_dir/$server_name%{REQUEST_URI}_$js -s
   RewriteRule .* $cache_dir/$server_name%{REQUEST_URI}_$js [L,QSA,T=text/javascript]
   ### BOOST END ###
Index: boost.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v
retrieving revision 1.3.2.2.2.5.2.81
diff -u -p -r1.3.2.2.2.5.2.81 boost.module
--- boost.module	29 Jul 2009 07:21:09 -0000	1.3.2.2.2.5.2.81
+++ boost.module	29 Jul 2009 08:21:56 -0000
@@ -31,12 +31,14 @@ define('BOOST_HALT_ON_ERRORS',       var
 define('BOOST_ROOT_FILE',            variable_get('boost_root_file', '.boost'));
 define('BOOST_FLUSH_DIR',            variable_get('boost_flush_dir', TRUE));
 define('BOOST_CACHE_XML',            variable_get('boost_cache_xml', TRUE));
+define('BOOST_CACHE_JSON',           variable_get('boost_cache_json', FALSE));
+define('BOOST_CACHE_HTML',           variable_get('boost_cache_html', TRUE));
+define('BOOST_CACHE_CSS',            variable_get('boost_cache_css', FALSE));
+define('BOOST_CACHE_JS',             variable_get('boost_cache_js', FALSE));
 define('BOOST_CACHE_LIFETIME',       variable_get('boost_cache_lifetime', 3600));
 define('BOOST_TIME',                 time());
 define('BOOST_CACHE_QUERY',          variable_get('boost_cache_query', TRUE));
 define('BOOST_IGNORE_FLUSH',         variable_get('boost_ignore_flush', 0));
-define('BOOST_CACHE_CSS',            variable_get('boost_cache_css', FALSE));
-define('BOOST_CACHE_JS',             variable_get('boost_cache_js', FALSE));
 define('BOOST_PERMISSIONS_FILE',     variable_get('boost_permissions_file', ''));
 define('BOOST_PERMISSIONS_DIR',      variable_get('boost_permissions_dir', ''));
 define('BOOST_OVERWRITE_FILE',       variable_get('boost_overwrite_file', FALSE));
@@ -49,7 +51,7 @@ define('BOOST_COOKIE',               var
 // This line is appended to the generated static files; it is very useful
 // for troubleshooting (e.g. determining whether one got the dynamic or
 // static version):
-define('BOOST_BANNER',               variable_get('boost_banner', "<!-- Page cached by Boost @ %cached_at, expires @ %expires_at -->\n"));
+define('BOOST_BANNER',               variable_get('boost_banner', "Page cached by Boost @ %cached_at, expires @ %expires_at"));
 
 // This is needed since the $user object is already destructed in _boost_ob_handler():
 define('BOOST_USER_ID',              @$GLOBALS['user']->uid);
@@ -663,11 +665,14 @@ function _boost_ob_handler($buffer) {
         boost_cache_set($GLOBALS['_boost_path'], $buffer);
         boost_cache_css_js_files($buffer);
         break;
-      case 'application/rss';
-      case 'text/xml';
-      case 'application/rss+xml';
+      case 'application/rss':
+      case 'text/xml':
+      case 'application/rss+xml':
         boost_cache_set($GLOBALS['_boost_path'], $buffer, BOOST_XML_EXTENSION);
         break;
+      case 'text/javascript':
+        boost_cache_set($GLOBALS['_boost_path'], $buffer, '.js');
+        break;
     }
   }
 
@@ -984,7 +989,31 @@ function boost_cache_set($path, $data = 
   $time = BOOST_TIME;
   $cached_at = date('Y-m-d H:i:s', $time);
   $expires_at = date('Y-m-d H:i:s', $time + BOOST_CACHE_LIFETIME);
-  $data = rtrim($data) . "\n" . str_replace(array('%cached_at', '%expires_at'), array($cached_at, $expires_at), BOOST_BANNER);
+  // Code commenting style baised on what is being cached.
+  switch ($extension) {
+    case '.html':
+      $comment_start = '<!-- ';
+      $comment_end = " -->\n";
+      if (!BOOST_CACHE_HTML) {
+        return FALSE;
+      }
+      break;
+    case '.xml':
+      $comment_start = '<!-- ';
+      $comment_end = " -->\n";
+      if (!BOOST_CACHE_XML) {
+        return FALSE;
+      }
+      break;
+    case '.js':
+      $comment_start = '/* ';
+      $comment_end = " */\n";
+      if (!BOOST_CACHE_JSON) {
+        return FALSE;
+      }
+      break;
+  }
+  $data = rtrim($data) . "\n" . $comment_start . str_replace(array('%cached_at', '%expires_at'), array($cached_at, $expires_at), BOOST_BANNER) . $comment_end;
 
   // Invoke hook_boost_preprocess($path, $data)
   foreach (module_implements('boost_preprocess') as $module) {
