diff options
Diffstat (limited to 'modules/simpletest/tests/https.php')
-rw-r--r-- | modules/simpletest/tests/https.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/simpletest/tests/https.php b/modules/simpletest/tests/https.php new file mode 100644 index 000000000..bc473875d --- /dev/null +++ b/modules/simpletest/tests/https.php @@ -0,0 +1,25 @@ +<?php +// $Id$ + +/** + * @file + * 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; +} + +// 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'; |