added: config: base_url_redirect
when true the server checks whether HTTP_HOST environment variable
is the same as base_url from the config (of course without the 'http://' part
and the last slash) - if it's not the same then the server
redirects you into a new location base_url+REQUEST_URI
changed: variables env_* from Request are never null (after Request::Read())
if the server didn't set such a variable it will be pointing into an empty string "\0"
git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@465 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -21,3 +21,27 @@ Data::Data()
|
||||
|
||||
|
||||
|
||||
void Data::SetAdditionalVariables()
|
||||
{
|
||||
SetHttpHost();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Data::SetHttpHost()
|
||||
{
|
||||
if( strncmp(base_url.c_str(), "http://", 7) == 0 )
|
||||
base_url_http_host = base_url.substr(7);
|
||||
else
|
||||
if( strncmp(base_url.c_str(), "https://", 8) == 0 )
|
||||
base_url_http_host = base_url.substr(8);
|
||||
else
|
||||
base_url_http_host.clear();
|
||||
|
||||
if( base_url_http_host.empty() )
|
||||
return;
|
||||
|
||||
// removing the last slash (if it is present)
|
||||
if( base_url_http_host[ base_url_http_host.size() - 1 ] == '/' )
|
||||
base_url_http_host.erase( base_url_http_host.end() - 1 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user