? boost-563380.patch
Index: boost.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.install,v
retrieving revision 1.2.2.1.2.3.2.33
diff -u -p -r1.2.2.1.2.3.2.33 boost.install
--- boost.install	31 Aug 2009 07:32:01 -0000	1.2.2.1.2.3.2.33
+++ boost.install	31 Aug 2009 23:33:36 -0000
@@ -66,6 +66,8 @@ function boost_requirements($phase) {
       }
       $htaccess = file_get_contents('.htaccess');
       $char = BOOST_CHAR;
+      $crawler_response = drupal_http_request(BOOST_CRAWLER_SELF);
+      $crawler_response = $crawler_response->code;
       foreach($cache_directories as $cache_directory) {
         _boost_mkdir_p($cache_directory);
         $root_file = file_put_contents($cache_directory . '/' . variable_get('boost_root_file', '.boost'), $cache_directory);
@@ -124,6 +126,22 @@ function boost_requirements($phase) {
           'value'       => $t('Cannot use "language fallback" language negotiation'),
         );
       }
+      if (!variable_get('boost_crawler_key', FALSE)) {
+        $requirements['boost_crawler'] = array(
+          'title'       => $t('Boost'),
+          'description' => $t('Please Run the database update, as the crawler key is not generated yet.'),
+          'severity'    => REQUIREMENT_ERROR,
+          'value'       => $t('Boost Crawler Key Not Found.'),
+        );
+      }
+      elseif ($crawler_response != 200) {
+        $requirements['boost_crawler'] = array(
+          'title'       => $t('Boost'),
+          'description' => $t('@number returned. Crawler URL (@url) is not available, please <a href="@link">report this issue</a>', array('@number' => $crawler_response, '@url' => BOOST_CRAWLER_SELF, '@link' => 'http://drupal.org/node/add/project-issue/boost')),
+          'severity'    => REQUIREMENT_ERROR,
+          'value'       => $t('Boost crawler did not get a 200 response.'),
+        );
+      }
       if (empty($requirements)) {
         $requirements['boost'] = array(
           'title'       => $t('Boost'),
@@ -632,4 +650,12 @@ function boost_update_6107() {
   // Flush caches, needed since some functions got renamed.
   drupal_flush_all_caches();
   return array(array('success' => TRUE, 'query' => 'Core Caches Flushed.'));
+}
+
+/**
+ * Update 6108 - Create crawler key
+ */
+function boost_update_6108() {
+  variable_set('boost_crawler_key', md5(mt_rand()));
+  return array(array('success' => TRUE, 'query' => 'Crawler key generated.'));
 }
\ No newline at end of file
Index: boost.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v
retrieving revision 1.3.2.2.2.5.2.125
diff -u -p -r1.3.2.2.2.5.2.125 boost.module
--- boost.module	31 Aug 2009 08:59:33 -0000	1.3.2.2.2.5.2.125
+++ boost.module	31 Aug 2009 23:33:37 -0000
@@ -71,6 +71,8 @@ define('BOOST_CRAWLER_THROTTLE',     var
 define('BOOST_CRAWLER_THREADS',      variable_get('boost_crawler_threads', 2));
 define('BOOST_CRAWLER_BATCH_SIZE',   variable_get('boost_crawler_batch_size', 25));
 define('BOOST_CRAWL_URL_ALIAS',      variable_get('boost_crawl_url_alias', FALSE));
+global $base_url;
+define('BOOST_CRAWLER_SELF',         $base_url . '/' . 'boost-crawler?nocache=1&key=' . variable_get('boost_crawler_key', FALSE));
 
 // This cookie is set for all authenticated users, so that they can be
 // excluded from caching (or in the future get a user-specific cached page):
@@ -2226,15 +2228,20 @@ function boost_crawler_run() {
   ini_set('output_buffering', 'off');
   $this_thread = (isset($_GET['thread']) && is_numeric($_GET['thread'])) ? $_GET['thread'] : NULL;
   $total_threads = (isset($_GET['total']) && is_numeric($_GET['total'])) ? $_GET['total'] : NULL;
-  $self = $base_url . '/' . 'boost-crawler?nocache=1';
-
-  // Only allow self to call this page if not called via cron.
-  if ($_GET['q'] == 'boost-crawler' && $_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']) {
-    drupal_access_denied();
-    exit;
-  }
+  $self = BOOST_CRAWLER_SELF;
 
   if ($_GET['q'] == 'boost-crawler') {
+    // if not called via cron, require key to be present in url
+    if ($_GET['key'] != variable_get('boost_crawler_key', FALSE)) {
+      drupal_access_denied();
+      exit;
+    }
+    // Test for access on status page
+    if ($_GET['test']) {
+      echo '<h1>OK</h1>';
+      exit;
+    }
+
     // Return html so connection closes
     boost_async_opp('async');
 
