Skip to content
Snippets Groups Projects
Unverified Commit 1218f38a authored by Jaime Pérez Crespo's avatar Jaime Pérez Crespo
Browse files

Do not add default ports to self URL when guessing it.

When we are invoked from an outside application, SimpleSAMLphp cannot use 'baseurlpath' and in that case it tries to guess the current URL. The port was always added, even if the default port was used, leading to possible issues when comparing URLs that should actually be equivalent.

This resolves #696.
parent 97d8b661
No related branches found
No related tags found
No related merge requests found
......@@ -780,12 +780,14 @@ class HTTP
* It doesn't matter which one of those cases we have. We just know we can't apply our base URL to the
* current URI, so we need to build it back from the PHP environment.
*/
$https = self::getServerHTTPS();
$protocol = 'http';
$protocol .= (self::getServerHTTPS()) ? 's' : '';
$protocol .= $https ? 's' : '';
$protocol .= '://';
$hostname = self::getServerHost();
$port = self::getServerPort();
$port = ($https && $port !== ':443') || (!$https && $port !== ':80') ? $port : '';
return $protocol.$hostname.$port.$_SERVER['REQUEST_URI'];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment