https.php 860 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @file
  4. * Fake an HTTPS request, for use during testing.
  5. */
  6. // Set a global variable to indicate a mock HTTPS request.
  7. $is_https_mock = empty($_SERVER['HTTPS']);
  8. // Change to HTTPS.
  9. $_SERVER['HTTPS'] = 'on';
  10. foreach ($_SERVER as $key => $value) {
  11. $_SERVER[$key] = str_replace('modules/simpletest/tests/https.php', 'index.php', $value);
  12. $_SERVER[$key] = str_replace('http://', 'https://', $_SERVER[$key]);
  13. }
  14. // Change current directory to the Drupal root.
  15. chdir('../../..');
  16. define('DRUPAL_ROOT', getcwd());
  17. require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
  18. // Make sure this file can only be used by simpletest.
  19. drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
  20. if (!drupal_valid_test_ua()) {
  21. header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
  22. exit;
  23. }
  24. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  25. menu_execute_active_handler();