httpd: add Hopedir directive specially for

(and by) walter harms <wharms AT bfs.de>;
 fix silly double-parse bug added in 21412.

function                                             old     new   delta
parse_conf                                          1532    1576     +44
This commit is contained in:
Denis Vlasenko 2008-07-20 23:25:32 +00:00
parent 7ae1cc16b4
commit 395410b748

View File

@ -37,6 +37,7 @@
*
* httpd.conf has the following format:
*
* H:/serverroot # define the server root. It will override -h
* A:172.20. # Allow address from 172.20.0.0/16
* A:10.0.0.0/25 # Allow any address from 10.0.0.0-10.0.0.127
* A:10.0.0.0/255.255.255.128 # Allow any address that previous set
@ -687,6 +688,13 @@ static void parse_conf(const char *path, int flag)
continue;
}
/* Do not allow jumping around using H in subdir's configs */
if (flag == FIRST_PARSE && *p0 == 'H') {
home_httpd = xstrdup(after_colon);
xchdir(home_httpd);
continue;
}
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH \
|| ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES \
|| ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
@ -2256,8 +2264,7 @@ static void mini_httpd_inetd(void)
#if ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
static void sighup_handler(int sig)
{
parse_conf(default_path_httpd_conf, sig == SIGHUP ? SIGNALED_PARSE : FIRST_PARSE);
parse_conf(default_path_httpd_conf, sig ? SIGNALED_PARSE : FIRST_PARSE);
signal_SA_RESTART_empty_mask(SIGHUP, sighup_handler);
}
#endif
@ -2392,10 +2399,14 @@ int httpd_main(int argc UNUSED_PARAM, char **argv)
#endif
#if ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
if (!(opt & OPT_INETD))
if (!(opt & OPT_INETD)) {
/* runs parse_conf() inside */
sighup_handler(0);
} else
#endif
parse_conf(default_path_httpd_conf, FIRST_PARSE);
{
parse_conf(default_path_httpd_conf, FIRST_PARSE);
}
xfunc_error_retval = 0;
if (opt & OPT_INETD)