From: Nick Kew Date: Mon, 21 Dec 2009 23:26:00 +0000 (+0000) Subject: (re)-introduce -T commandline option to suppress documentroot check at startup X-Git-Tag: 2.3.5~73 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=71702c45acbf4947473d1dc00539cfb285263735;p=apache (re)-introduce -T commandline option to suppress documentroot check at startup PR 41887 Patch by Jan van den Berg git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@893027 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 1dc2518400..27deb020bd 100644 --- a/CHANGES +++ b/CHANGES @@ -22,6 +22,10 @@ Changes with Apache 2.3.5 *) Core: reject NULLs in request line or request headers. PR 43039 [Nick Kew] + *) Core: (re)-introduce -T commandline option to suppress documentroot + check at startup. + PR 41887 [Jan van den Berg ] + Changes with Apache 2.3.4 *) Replace AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex, diff --git a/docs/manual/programs/httpd.xml b/docs/manual/programs/httpd.xml index 4115f5adf6..93328a8b18 100644 --- a/docs/manual/programs/httpd.xml +++ b/docs/manual/programs/httpd.xml @@ -152,6 +152,10 @@ places where the directive is valid. Directives provided by shared modules are n
Show the settings as parsed from the config file (currently only shows the virtualhost settings).
+
-T
+ +
Skip document root check at startup/restart.
+
-t
Run syntax tests for configuration files only. The program diff --git a/include/http_main.h b/include/http_main.h index d32fae93d6..9af84c69e5 100644 --- a/include/http_main.h +++ b/include/http_main.h @@ -33,7 +33,7 @@ * in apr_getopt() format. Use this for default'ing args that the MPM * can safely ignore and pass on from its rewrite_args() handler. */ -#define AP_SERVER_BASEARGS "C:c:D:d:E:e:f:vVlLtSMh?X" +#define AP_SERVER_BASEARGS "C:c:D:d:E:e:f:vVlLtTSMh?X" #ifdef __cplusplus extern "C" { @@ -58,6 +58,8 @@ AP_DECLARE_DATA extern apr_array_header_t *ap_server_post_read_config; /** An array of all -D defines on the command line. This allows people to * effect the server based on command line options */ AP_DECLARE_DATA extern apr_array_header_t *ap_server_config_defines; +/** Available integer for using the -T switch */ +AP_DECLARE_DATA extern int ap_document_root_check; /** * An optional function to send signal to server on presence of '-k' diff --git a/server/core.c b/server/core.c index e97a103dc8..b942e1e52a 100644 --- a/server/core.c +++ b/server/core.c @@ -1162,13 +1162,19 @@ static const char *set_document_root(cmd_parms *cmd, void *dummy, return err; } + /* When ap_document_root_check is false; skip all the stuff below */ + if (!ap_document_root_check) { + conf->ap_document_root = arg; + return NULL; + } + /* Make it absolute, relative to ServerRoot */ arg = ap_server_root_relative(cmd->pool, arg); if (arg == NULL) { return "DocumentRoot must be a directory"; } - /* TODO: ap_configtestonly && ap_docrootcheck && */ + /* TODO: ap_configtestonly */ if (apr_filepath_merge((char**)&conf->ap_document_root, NULL, arg, APR_FILEPATH_TRUENAME, cmd->pool) != APR_SUCCESS || !ap_is_directory(cmd->pool, arg)) { diff --git a/server/main.c b/server/main.c index 8888a36cf5..ba538261c4 100644 --- a/server/main.c +++ b/server/main.c @@ -370,7 +370,7 @@ static void usage(process_rec *process) pad); #endif ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, - " %s [-v] [-V] [-h] [-l] [-L] [-t] [-S]", pad); + " %s [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]", pad); ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "Options:"); @@ -449,10 +449,15 @@ static void usage(process_rec *process) " -M : a synonym for -t -D DUMP_MODULES"); ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, " -t : run syntax check for config files"); + ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, + " -T : start without DocumentRoot(s) check"); destroy_and_exit_process(process, 1); } +/* Set ap_document_root_check to default value: true */ +AP_DECLARE_DATA int ap_document_root_check = 1; + int main(int argc, const char * const argv[]) { char c; @@ -612,6 +617,10 @@ int main(int argc, const char * const argv[]) configtestonly = 1; break; + case 'T': + ap_document_root_check = 0; + break; + case 'S': configtestonly = 1; new = (char **)apr_array_push(ap_server_config_defines);