]> granicus.if.org Git - apache/commitdiff
(re)-introduce -T commandline option to suppress documentroot check at startup
authorNick Kew <niq@apache.org>
Mon, 21 Dec 2009 23:26:00 +0000 (23:26 +0000)
committerNick Kew <niq@apache.org>
Mon, 21 Dec 2009 23:26:00 +0000 (23:26 +0000)
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

CHANGES
docs/manual/programs/httpd.xml
include/http_main.h
server/core.c
server/main.c

diff --git a/CHANGES b/CHANGES
index 1dc2518400c227db21705ed61ca7984a636bf995..27deb020bdb4e693c729b325c3adde146f89018d 100644 (file)
--- 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 <janvdberg gmail.com>]
+
 Changes with Apache 2.3.4
 
   *) Replace AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex,
index 4115f5adf69d93513e0a78456cbcdc30f4c5adfd..93328a8b18f6cc18407b0807374c6939b0c8efc1 100644 (file)
@@ -152,6 +152,10 @@ places where the directive is valid. Directives provided by shared modules are n
 <dd>Show the settings as parsed from the config file (currently only
 shows the virtualhost settings).</dd>
 
+<dt><code>-T</code></dt>
+
+<dd>Skip document root check at startup/restart.</dd>
+
 <dt><code>-t</code></dt>
 
 <dd>Run syntax tests for configuration files only.  The program
index d32fae93d626de8c1c0d8e8d7345e3ee6550bee6..9af84c69e5f7208cce650eb5c31186675cc132b5 100644 (file)
@@ -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'
index e97a103dc8c3fdc98651f1d678384ab2bf675f3a..b942e1e52a7b2810d26e895b6d20882fc0e09f8b 100644 (file)
@@ -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)) {
index 8888a36cf5474874a2a4634eeb187ef3fd17f691..ba538261c4da5aab6b56e2d44d8802d0e5148d14 100644 (file)
@@ -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);