From c731b9f79eb12368b7003f21496c6e371af3d606 Mon Sep 17 00:00:00 2001 From: fidian Date: Sun, 29 Apr 2001 15:04:26 +0000 Subject: [PATCH] * Improved HTTPS detection git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1323 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/strings.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/functions/strings.php b/functions/strings.php index 0180871f..4dea476e 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -237,18 +237,22 @@ # # http://www.myhost.com/squirrelmail/src/login.php - global $PHP_SELF, $SERVER_NAME, $HTTPS, $HTTP_HOST, $SERVER_PORT; - - // check for HTTPS mode (you must have 'SSLOptions +StdEnvVars' - // in your apache config). - $HTTPS=getenv('HTTPS'); + global $PHP_SELF, $SERVER_NAME, $HTTP_HOST, $SERVER_PORT, + $HTTP_SERVER_VARS; // Get the path $path = substr($PHP_SELF, 0, strrpos($PHP_SELF, '/')); // Check if this is a HTTPS or regular HTTP request $proto = 'http://'; - if(isset($HTTPS) && !strcasecmp($HTTPS, 'on') ) { + // If you have 'SSLOptions +StdEnvVars' in your apache config + // OR if you have HTTPS in your HTTP_SERVER_VARS + // OR if you are on port 443 + $getEnvVar = getenv('HTTPS'); + if ((isset($getEnvVar) && !strcasecmp($getEnvVar, 'on')) || + (isset($HTTP_SERVER_VARS['HTTPS'])) || + (isset($HTTP_SERVER_VARS['SERVER_PORT']) && + $HTTP_SERVER_VARS['SERVER_PORT'] == 443)) { $proto = 'https://'; } -- 2.25.1