Commit cfe9983a authored by Stefan Ruijsenaars's avatar Stefan Ruijsenaars

Issue #2821203 by plach: Factor out logic to detect HTTPS requests into an API function

parent 2e1c6723
......@@ -718,6 +718,16 @@ function drupal_valid_http_host($host) {
&& preg_match('/^\[?(?:[a-zA-Z0-9-:\]_]+\.?)+$/', $host);
}
/**
* Checks whether an HTTPS request is being served.
*
* @return bool
* TRUE if the request is HTTPS, FALSE otherwise.
*/
function drupal_is_https() {
return isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
}
/**
* Sets the base URL, cookie domain, and session name from configuration.
*/
......@@ -731,7 +741,7 @@ function drupal_settings_initialize() {
if (file_exists(DRUPAL_ROOT . '/' . conf_path() . '/settings.php')) {
include_once DRUPAL_ROOT . '/' . conf_path() . '/settings.php';
}
$is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
$is_https = drupal_is_https();
if (isset($base_url)) {
// Parse fixed base URL from settings.php.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment