changed config/config.php to add ['REQUEST_PROTOCOL'].

changed the subversion repository anchor to have the trailing slash
This commit is contained in:
hyung-hwan 2014-10-12 13:05:40 +00:00
parent 9dcf9a5daa
commit 270c2c8f8b
4 changed files with 22 additions and 13 deletions

View File

@ -86,9 +86,16 @@ api_base_url = "http://127.0.0.1"
; https://${SERVER_NAME}/svn. ; https://${SERVER_NAME}/svn.
; You may specify multiple URLs separated with a comma as shown below: ; You may specify multiple URLs separated with a comma as shown below:
; "http://${SERVER_NAME}/svn, https://${SERVER_NAME}/svn" ; "http://${SERVER_NAME}/svn, https://${SERVER_NAME}/svn"
; REQUEST_PROTOCOL is resolved to either http or https. ; All specified URLs are shown in the repository list of the project overview
; page.
; You may use various items available in $_SERVER when composing the URL.
; For example, ${HTTP_HOST} maps to $_SERVER{'HTTP_HOST'}.
; Additionally, $_SERVER{'REQUEST_PROTOCOL'} added by config/config.php
; can be referenced with ${REQUEST_PROTOCOL} and it is resolved to either
; http or https.
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
svn_base_url = "${REQUEST_PROTOCOL}://${SERVER_NAME}:${SERVER_PORT}/svn" ;svn_base_url = "${REQUEST_PROTOCOL}://${SERVER_NAME}:${SERVER_PORT}/svn"
svn_base_url = "${REQUEST_PROTOCOL}://${HTTP_HOST}/svn"
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; Login model to use. ; Login model to use.

View File

@ -17,17 +17,25 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']))
{ {
/* set to https if the first X-Forwarded-Proto is https */ /* set to https if the first X-Forwarded-Proto is https */
if (array_search ("https", array_map ('strtolower', preg_split("/[\s,]+/", $_SERVER['HTTP_X_FORWARDED_PROTO']))) === 0) if (array_search ("https", array_map ('strtolower', preg_split("/[\s,]+/", $_SERVER['HTTP_X_FORWARDED_PROTO']))) === 0)
{
$config['base_url'] = 'https'; $config['base_url'] = 'https';
$_SERVER['REQUEST_PROTOCOL'] = 'https';
}
else else
{
$config['base_url'] = 'http'; $config['base_url'] = 'http';
$_SERVER['REQUEST_PROTOCOL'] = 'http';
}
} }
else if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') else if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
{ {
$config['base_url'] = 'https'; $config['base_url'] = 'https';
$_SERVER['REQUEST_PROTOCOL'] = 'https';
} }
else else
{ {
$config['base_url'] = 'http'; $config['base_url'] = 'http';
$_SERVER['REQUEST_PROTOCOL'] = 'http';
} }
$config['base_url'] .= "://{$_SERVER['HTTP_HOST']}"; $config['base_url'] .= "://{$_SERVER['HTTP_HOST']}";

View File

@ -120,7 +120,7 @@ foreach ($urls as $url)
$url = trim($url); $url = trim($url);
if ($url == '') continue; if ($url == '') continue;
print '<li>'; print '<li>';
print anchor ($this->converter->expand($url,$_SERVER) . "/{$project->id}"); print anchor ($this->converter->expand($url,$_SERVER) . "/{$project->id}/");
print '</li>'; print '</li>';
} }
?> ?>

View File

@ -46,6 +46,10 @@ define('APPPATH', $application_folder.'/');
*/ */
if (CODEPOT_HTTPS_COMPULSORY) if (CODEPOT_HTTPS_COMPULSORY)
{ {
// this option is not affected by X-Forwared-Proto or other similar headers.
// this option mandates SSL over the direct connection to the origin server.
// it doesn't care if the client is using SSL when the connection is relayed
// by intermediate proxy servers.
if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')
{ {
/* force https except api calls */ /* force https except api calls */
@ -63,16 +67,6 @@ if (CODEPOT_HTTPS_COMPULSORY)
} }
} }
/*
|---------------------------------------------------------------
| EXTRA INFORMATION
|---------------------------------------------------------------
*/
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
$_SERVER['REQUEST_PROTOCOL'] = 'https';
else
$_SERVER['REQUEST_PROTOCOL'] = 'http';
/* /*
|--------------------------------------------------------------- |---------------------------------------------------------------
| LOAD THE FRONT CONTROLLER | LOAD THE FRONT CONTROLLER