2012-07-20 Hirofumi Kosaka <kosaka@rworks.jp>

* index.php: bug fix: 'Enforce https' led to wrong URL to
	cause "error 310: too many redirects".
	* include/functions_ui.php: bug fix: ui_get_full_url() had
	returned URL with unnecessary wrong port specifier ":80",
	when switching 'http' to 'https' by 'enforce https'.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6794 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
hkosaka 2012-07-20 06:50:28 +00:00
parent f753985e10
commit 7daecf4533
3 changed files with 24 additions and 10 deletions

View File

@ -1,3 +1,11 @@
2012-07-20 Hirofumi Kosaka <kosaka@rworks.jp>
* index.php: bug fix: 'Enforce https' led to wrong URL to
cause "error 310: too many redirects".
* include/functions_ui.php: bug fix: ui_get_full_url() had
returned URL with unnecessary wrong port specifier ":80",
when switching 'http' to 'https' by 'enforce https'.
2012-07-19 Sergio Martin <sergio.martin@artica.es>
* godmode/modules/manage_network_components_form.php

View File

@ -1927,27 +1927,33 @@ function ui_get_url_refresh ($params = false, $relative = true, $add_post = true
*/
function ui_get_full_url ($url = '') {
global $config;
$port = null; // null means 'use the starndard port'
if ($config['https']) {
//When $config["https"] is set, always force https
if (isset ($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === true || $_SERVER['HTTPS'] == 'on')) {
$protocol = 'https';
$ssl = true;
if ( $_SERVER['SERVER_PORT'] != 443) {
$port = $_SERVER['SERVER_PORT'];
}
}
elseif (isset ($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === true || $_SERVER['HTTPS'] == 'on')) {
elseif ($config['https']) {
//When $config["https"] is set, enforce https
$protocol = 'https';
$ssl = true;
}
else {
$protocol = 'http';
$ssl = false;
if ( $_SERVER['SERVER_PORT'] != 80) {
$port = $_SERVER['SERVER_PORT'];
}
}
$fullurl = $protocol.'://' . $_SERVER['SERVER_NAME'];
if ((!$ssl && $_SERVER['SERVER_PORT'] != 80) || ($ssl && $_SERVER['SERVER_PORT'] != 443)) {
$fullurl .= ":".$_SERVER['SERVER_PORT'];
// using a different port than the standard
if ( $port != null ) {
$fullurl .= ":".$port;
}
if ($url === '') {
$url = $_SERVER['REQUEST_URI'];
}

View File

@ -92,7 +92,7 @@ if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
// http://en.wikipedia.org/wiki/HTTP_response_splitting
$url = str_replace ("\n", "", $url);
header ('Location: '.$query);
header ('Location: '.$url);
exit; //Always exit after sending location headers
}