http.php 897 B

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