httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r168202 - in /httpd/httpd/trunk: CHANGES include/ap_mmn.h include/http_config.h modules/generators/mod_autoindex.c server/config.c
Date Wed, 04 May 2005 22:23:02 GMT
Author: pquerna
Date: Wed May  4 15:23:00 2005
New Revision: 168202

URL: http://svn.apache.org/viewcvs?rev=168202&view=rev
Log:
Add AP_INIT_TAKE_ARGV. There can be some inconsistent results because of the behavoir of ap_getword_conf.
Do not rely upon any last argument that is "".  If the argument is in the middle of the line,
it should work correctly.

This is updated from the version sent to dev@httpd to fix the behavoir with 0 arguments.

* include/http_config.h: minor MMN bump for the new interface.
* modules/generators/mod_autoindex.c: Migrate IndexOptions to the new ARGV command type.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/http_config.h
    httpd/httpd/trunk/modules/generators/mod_autoindex.c
    httpd/httpd/trunk/server/config.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?rev=168202&r1=168201&r2=168202&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES (original)
+++ httpd/httpd/trunk/CHANGES Wed May  4 15:23:00 2005
@@ -2,6 +2,9 @@
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Add AP_INIT_TAKE_ARGV for configuration commands. (minor MMN bump) 
+     [Paul Querna]
+
   *) worker and event mpms: don't take down the whole server for a transient
      thread creation failure.  PR 34514 [Greg Ames]
 

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/include/ap_mmn.h?rev=168202&r1=168201&r2=168202&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Wed May  4 15:23:00 2005
@@ -94,6 +94,7 @@
  *                        with ap_ in the win32 os.h.
  * 20050305.0 (2.1.4-dev) added pid and generation fields to worker_score
  * 20050305.1 (2.1.5-dev) added ap_vhost_iterate_given_conn.
+ * 20050305.2 (2.1.5-dev) added AP_INIT_TAKE_ARGV.
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
@@ -101,7 +102,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20050305
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 1                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 2                     /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/include/http_config.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/include/http_config.h?rev=168202&r1=168201&r2=168202&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_config.h (original)
+++ httpd/httpd/trunk/include/http_config.h Wed May  4 15:23:00 2005
@@ -57,7 +57,8 @@
     TAKE3,			/**< three arguments only */
     TAKE23,			/**< two or three arguments */
     TAKE123,			/**< one, two or three arguments */
-    TAKE13			/**< one or three arguments */
+    TAKE13,			/**< one or three arguments */
+    TAKE_ARGV			/**< an argc and argv are passed */
 };
 /**
  * This structure is passed to a command which is being invoked,
@@ -78,6 +79,9 @@
     /** function to call for a raw-args */
     const char *(*raw_args) (cmd_parms *parms, void *mconfig,
 			     const char *args);
+    /** function to call for a argv/argc */
+    const char *(*take_argv) (cmd_parms *parms, void *mconfig,
+			     int argc, char *const argv[]);
     /** function to call for a take1 */
     const char *(*take1) (cmd_parms *parms, void *mconfig, const char *w);
     /** function to call for a take2 */
@@ -94,6 +98,8 @@
 # define AP_NO_ARGS	func.no_args
 /** This configuration directive will handle it's own parsing of arguments*/
 # define AP_RAW_ARGS	func.raw_args
+/** This configuration directive will handle it's own parsing of arguments*/
+# define AP_TAKE_ARGV	func.take_argv
 /** This configuration directive takes 1 argument*/
 # define AP_TAKE1	func.take1
 /** This configuration directive takes 2 arguments */
@@ -109,6 +115,9 @@
 /** method of declaring a directive with raw argument parsing */
 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
     { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }
+/** method of declaring a directive with raw argument parsing */
+# define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
+    { directive, { .take_argv=func }, mconfig, where, TAKE_ARGV, help }
 /** method of declaring a directive which takes 1 argument */
 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
     { directive, { .take1=func }, mconfig, where, TAKE1, help }
@@ -146,6 +155,7 @@
 
 # define AP_NO_ARGS  func
 # define AP_RAW_ARGS func
+# define AP_TAKE_ARGV func
 # define AP_TAKE1    func
 # define AP_TAKE2    func
 # define AP_TAKE3    func
@@ -155,6 +165,8 @@
     { directive, func, mconfig, where, RAW_ARGS, help }
 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
     { directive, func, mconfig, where, RAW_ARGS, help }
+# define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, TAKE_ARGV, help }
 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
     { directive, func, mconfig, where, TAKE1, help }
 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \

Modified: httpd/httpd/trunk/modules/generators/mod_autoindex.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/generators/mod_autoindex.c?rev=168202&r1=168201&r2=168202&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/mod_autoindex.c (original)
+++ httpd/httpd/trunk/modules/generators/mod_autoindex.c Wed May  4 15:23:00 2005
@@ -312,8 +312,9 @@
     return NULL;
 }
 
-static const char *add_opts(cmd_parms *cmd, void *d, const char *optstr)
+static const char *add_opts(cmd_parms *cmd, void *d, int argc, char *const argv[])
 {
+    int i;
     char *w;
     apr_int32_t opts;
     apr_int32_t opts_add;
@@ -324,10 +325,11 @@
     opts = d_cfg->opts;
     opts_add = d_cfg->incremented_opts;
     opts_remove = d_cfg->decremented_opts;
-    while (optstr[0]) {
+
+    for (i = 0; i < argc; i++) {
         int option = 0;
+        w = argv[i];
 
-        w = ap_getword_conf(cmd->pool, &optstr);
         if ((*w == '+') || (*w == '-')) {
             action = *(w++);
         }
@@ -554,8 +556,8 @@
     AP_INIT_ITERATE2("AddAltByEncoding", add_alt, BY_ENCODING, DIR_CMD_PERMS,
                      "alternate descriptive text followed by one or more "
                      "content encodings"),
-    AP_INIT_RAW_ARGS("IndexOptions", add_opts, NULL, DIR_CMD_PERMS,
-                     "one or more index options [+|-][]"),
+    AP_INIT_TAKE_ARGV("IndexOptions", add_opts, NULL, DIR_CMD_PERMS,
+                      "one or more index options [+|-][]"),
     AP_INIT_TAKE2("IndexOrderDefault", set_default_order, NULL, DIR_CMD_PERMS,
                   "{Ascending,Descending} {Name,Size,Description,Date}"),
     AP_INIT_ITERATE("IndexIgnore", add_ignore, NULL, DIR_CMD_PERMS,

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/config.c?rev=168202&r1=168201&r2=168202&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Wed May  4 15:23:00 2005
@@ -648,6 +648,8 @@
  * invoking the function...
  */
 
+#define AP_MAX_ARGC 64
+
 static const char *invoke_cmd(const command_rec *cmd, cmd_parms *parms,
                               void *mconfig, const char *args)
 {
@@ -666,6 +668,23 @@
         args = ap_resolve_env(parms->pool,args);
 #endif
         return cmd->AP_RAW_ARGS(parms, mconfig, args);
+
+    case TAKE_ARGV:
+        {
+            char *argv[AP_MAX_ARGC];
+            int argc = 0;
+
+            do {
+                w = ap_getword_conf(parms->pool, &args);
+                if (*w == '\0' && *args == '\0') {
+                    break;
+                }
+                argv[argc] = w;
+                argc++;
+            } while (argc < AP_MAX_ARGC && *args != '\0');
+
+            return cmd->AP_TAKE_ARGV(parms, mconfig, argc, argv);
+        }
 
     case NO_ARGS:
         if (*args != 0)



Mime
View raw message