From 2af48301fe853190f6904637a530f638a5b6cfb6 Mon Sep 17 00:00:00 2001 From: fidian Date: Mon, 2 Oct 2000 20:35:25 +0000 Subject: [PATCH] Attempted to auto-detect port number in get_location() git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@775 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/strings.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/functions/strings.php b/functions/strings.php index 38566963..fa455664 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -203,7 +203,7 @@ # # http://www.myhost.com/squirrelmail/src/login.php - global $PHP_SELF, $SERVER_NAME, $HTTPS, $HTTP_HOST; + global $PHP_SELF, $SERVER_NAME, $HTTPS, $HTTP_HOST, $HTTP_SERVER_VARS; // Get the path $path = substr($PHP_SELF, 0, strrpos($PHP_SELF, '/')); @@ -214,13 +214,19 @@ $proto = "https://"; } + if ($HTTP_SERVER_VARS['SERVER_PORT']) { + if ($HTTP_SERVER_VARS['SERVER_PORT'] != 80) { + $port = ':' . $HTTP_SERVER_VARS['SERVER_PORT']; + } + } + // Get the hostname from the Host header or server config. // Fallback is to omit the server name and use a relative URI, // although this is not RFC 2616 compliant. if(isset($HTTP_HOST) && !empty($HTTP_HOST)) { - $location = $proto . $HTTP_HOST . $path; + $location = $proto . $HTTP_HOST . $port . $path; } else if(isset($SERVER_NAME) && !empty($SERVER_NAME)) { - $location = $proto . $SERVER_NAME . $path; + $location = $proto . $SERVER_NAME . $port . $path; } else { $location = $path; } -- 2.25.1