diff options
Diffstat (limited to 'modules/simpletest/tests/https.php')
-rw-r--r-- | modules/simpletest/tests/https.php | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/modules/simpletest/tests/https.php b/modules/simpletest/tests/https.php index 121e4ee17..ba618c151 100644 --- a/modules/simpletest/tests/https.php +++ b/modules/simpletest/tests/https.php @@ -6,23 +6,27 @@ * Fake an https request, for use during testing. */ -// Negated copy of the condition in _drupal_bootstrap(). If the user agent is -// not from simpletest then disallow access. -if (!(isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], "simpletest") !== FALSE))) { - exit; -} - // Set a global variable to indicate a mock HTTPS request. $is_https_mock = empty($_SERVER['HTTPS']); // Change to https. $_SERVER['HTTPS'] = 'on'; - -// Change to index.php. -chdir('../../..'); foreach ($_SERVER as $key => $value) { $_SERVER[$key] = str_replace('modules/simpletest/tests/https.php', 'index.php', $value); $_SERVER[$key] = str_replace('http://', 'https://', $_SERVER[$key]); } -require_once 'index.php'; +// Change current directory to the Drupal root. +chdir('../../..'); +define('DRUPAL_ROOT', getcwd()); +require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; + +// Make sure this file can only be used by simpletest. +drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION); +if (!drupal_valid_test_ua()) { + header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); + exit; +} + +drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); +menu_execute_active_handler(); |