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