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:
2008-12-12 03:11:29 +00:00
parent 3462cdf827
commit 023faa66fc
8 changed files with 109 additions and 26 deletions

View File

@@ -13,6 +13,7 @@
#include <string>
#include <vector>
#include <map>
#include <string.h>
#include "misc.h"
#include "item.h"
@@ -64,6 +65,11 @@ public:
std::string base_url;
std::string http_session_id_name;
// when the HOST_HTTP environment variable doesn't point into 'base_url' (the part 'http://' and the last slash is removed)
// the server will redirect into 'base_url' + 'REQUEST_URI'
// it's useful when you want to redirect from 'mydomain.tld' into 'www.mydomain.tld' etc.
bool base_url_redirect;
// if there is one item in a directory
// it will be showed
// (instead of showing directory contents)
@@ -73,21 +79,29 @@ public:
// end config members
// -----------------------------------------------------------------
// false at the beginning
bool stdout_is_closed;
// true if there was the SIGHUP signal
// true if there was SIGHUP signal
volatile bool signal_hup;
// contains current directories tree
Dir dir;
// based on base_url
// set by SetAdditionalVariables()
std::string base_url_http_host;
// call this method after the config file is read
void SetAdditionalVariables();
Data();
private:
void SetHttpHost();
};