Skip to content
Snippets Groups Projects
Commit 5ffb67b6 authored by rswindell's avatar rswindell
Browse files

Added option to enable virtual hosts (disabled by default).

parent d6db8feb
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,7 @@ static ini_bitdesc_t ftp_options[] = { ...@@ -47,6 +47,7 @@ static ini_bitdesc_t ftp_options[] = {
static ini_bitdesc_t web_options[] = { static ini_bitdesc_t web_options[] = {
{ WEB_OPT_DEBUG_TX ,"DEBUG_TX" }, { WEB_OPT_DEBUG_TX ,"DEBUG_TX" },
{ WEB_OPT_VIRTUAL_HOSTS ,"VIRTUAL_HOSTS" },
/* shared bits */ /* shared bits */
{ BBS_OPT_NO_HOST_LOOKUP ,"NO_HOST_LOOKUP" }, { BBS_OPT_NO_HOST_LOOKUP ,"NO_HOST_LOOKUP" },
......
...@@ -910,9 +910,13 @@ static BOOL check_request(http_session_t * session) ...@@ -910,9 +910,13 @@ static BOOL check_request(http_session_t * session)
FILE* file; FILE* file;
lprintf("Validating request: %s",session->req.request); lprintf("Validating request: %s",session->req.request);
if(session->host[0]) if(!(startup->options&WEB_OPT_VIRTUAL_HOSTS))
session->host[0]=0;
if(session->host[0]) {
sprintf(path,"%s%s",root_dir,session->host);
if(isdir(path))
sprintf(path,"%s%s%s",root_dir,session->host,session->req.request); sprintf(path,"%s%s%s",root_dir,session->host,session->req.request);
else } else
sprintf(path,"%s%s",root_dir,session->req.request); sprintf(path,"%s%s",root_dir,session->req.request);
if(FULLPATH(session->req.request,path,sizeof(session->req.request))==NULL) { if(FULLPATH(session->req.request,path,sizeof(session->req.request))==NULL) {
......
...@@ -90,6 +90,7 @@ typedef struct { ...@@ -90,6 +90,7 @@ typedef struct {
} web_startup_t; } web_startup_t;
#define WEB_OPT_DEBUG_TX (1<<0) /* Log all transmitted responses */ #define WEB_OPT_DEBUG_TX (1<<0) /* Log all transmitted responses */
#define WEB_OPT_VIRTUAL_HOSTS (1<<1) /* Use virutal host html subdirs */
#ifdef DLLEXPORT #ifdef DLLEXPORT
#undef DLLEXPORT #undef DLLEXPORT
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment