You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2008/04/06 02:46:44 UTC

svn commit: r645190 - /httpd/httpd/trunk/server/core.c

Author: wrowe
Date: Sat Apr  5 17:46:42 2008
New Revision: 645190

URL: http://svn.apache.org/viewvc?rev=645190&view=rev
Log:
If you study all of the directive implementations, you'll note
that we get less than 20% of the NOT_IN_LIMIT rules correct.

<Limit > works in about 4 directive contexts and yet, we ignore
this fact for 100's of directives.  Simply eliminate this
nonsense in anticipation of a 100% solution.



Modified:
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=645190&r1=645189&r2=645190&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Sat Apr  5 17:46:42 2008
@@ -1081,8 +1081,7 @@
     void *sconf = cmd->server->module_config;
     core_server_config *conf = ap_get_module_config(sconf, &core_module);
 
-    const char *err = ap_check_cmd_context(cmd,
-                                           NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
     if (err != NULL) {
         return err;
     }
@@ -1115,8 +1114,7 @@
     void *sconf = cmd->server->module_config;
     core_server_config *conf = ap_get_module_config(sconf, &core_module);
 
-    const char *err = ap_check_cmd_context(cmd,
-                                           NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
     if (err != NULL) {
         return err;
     }
@@ -1131,11 +1129,6 @@
 {
     core_dir_config *d = d_;
 
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
-    if (err != NULL) {
-        return err;
-    }
-
     if (!strcasecmp(arg, "Off")) {
        d->add_default_charset = ADD_DEFAULT_CHARSET_OFF;
     }
@@ -1157,8 +1150,7 @@
     void *sconf = cmd->server->module_config;
     core_server_config *conf = ap_get_module_config(sconf, &core_module);
 
-    const char *err = ap_check_cmd_context(cmd,
-                                           NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
     if (err != NULL) {
         return err;
     }
@@ -1214,11 +1206,6 @@
     int error_number, index_number, idx500;
     enum { MSG, LOCAL_PATH, REMOTE_PATH } what = MSG;
 
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
-    if (err != NULL) {
-        return err;
-    }
-
     /* 1st parameter should be a 3 digit number, which we recognize;
      * convert it into an array index
      */
@@ -1343,11 +1330,6 @@
     char *w;
     char *k, *v;
 
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
-    if (err != NULL) {
-        return err;
-    }
-
     /* Throw a warning if we're in <Location> or <Files> */
     if (ap_check_cmd_context(cmd, NOT_IN_LOCATION | NOT_IN_FILES)) {
         ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
@@ -1612,11 +1594,6 @@
                                    const char *arg)
 {
     core_dir_config *d = d_;
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
-
-    if (err != NULL) {
-        return err;
-    }
 
     if (strcasecmp(arg, "on") == 0) {
         d->enable_mmap = ENABLE_MMAP_ON;
@@ -1635,11 +1612,6 @@
                                    const char *arg)
 {
     core_dir_config *d = d_;
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
-
-    if (err != NULL) {
-        return err;
-    }
 
     if (strcasecmp(arg, "on") == 0) {
         d->enable_sendfile = ENABLE_SENDFILE_ON;
@@ -1753,8 +1725,7 @@
     ap_regex_t *r = NULL;
     const command_rec *thiscmd = cmd->cmd;
 
-    const char *err = ap_check_cmd_context(cmd,
-                                           NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
     if (err != NULL) {
         return err;
     }
@@ -1857,8 +1828,7 @@
     ap_regex_t *r = NULL;
     const command_rec *thiscmd = cmd->cmd;
     ap_conf_vector_t *new_url_conf = ap_create_per_dir_config(cmd->pool);
-    const char *err = ap_check_cmd_context(cmd,
-                                           NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
     if (err != NULL) {
         return err;
     }
@@ -1926,7 +1896,7 @@
     const command_rec *thiscmd = cmd->cmd;
     core_dir_config *c = mconfig;
     ap_conf_vector_t *new_file_conf = ap_create_per_dir_config(cmd->pool);
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT|NOT_IN_LOCATION);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_LOCATION);
 
     if (err != NULL) {
         return err;
@@ -2006,7 +1976,7 @@
     const command_rec *thiscmd = cmd->cmd;
     core_dir_config *c = mconfig;
     ap_conf_vector_t *new_file_conf = ap_create_per_dir_config(cmd->pool);
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT|NOT_IN_LOCATION);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_LOCATION);
     const char *condition;
     int expr_err = 0;
 
@@ -2290,7 +2260,7 @@
 static const char *set_protocol(cmd_parms *cmd, void *dummy,
                                 const char *arg)
 {
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
     core_server_config *conf = ap_get_module_config(cmd->server->module_config,
                                                     &core_module);
     char* proto;
@@ -2315,7 +2285,7 @@
     char *struct_ptr = (char *)cmd->server;
 
     const char *err = ap_check_cmd_context(cmd,
-                                           NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+                                           NOT_IN_DIR_LOC_FILE);
     if (err != NULL) {
         return err;
     }
@@ -2334,7 +2304,7 @@
 
 static const char *server_hostname_port(cmd_parms *cmd, void *dummy, const char *arg)
 {
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
     const char *portstr, *part;
     char *scheme;
     int port;
@@ -2379,11 +2349,6 @@
                                       const char *arg)
 {
     core_dir_config *d = d_;
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
-
-    if (err != NULL) {
-        return err;
-    }
 
     if (strcasecmp(arg, "On") == 0) {
         d->server_signature = srv_sig_on;
@@ -2421,7 +2386,7 @@
 
 static const char *set_timeout(cmd_parms *cmd, void *dummy, const char *arg)
 {
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
 
     if (err != NULL) {
         return err;
@@ -2434,11 +2399,6 @@
 static const char *set_allow2f(cmd_parms *cmd, void *d_, int arg)
 {
     core_dir_config *d = d_;
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
-
-    if (err != NULL) {
-        return err;
-    }
 
     d->allow_encoded_slashes = arg != 0;
     return NULL;
@@ -2448,11 +2408,6 @@
                                         const char *arg)
 {
     core_dir_config *d = d_;
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
-
-    if (err != NULL) {
-        return err;
-    }
 
     if (!strcasecmp(arg, "on")) {
         d->hostname_lookups = HOSTNAME_LOOKUP_ON;
@@ -2473,7 +2428,7 @@
 static const char *set_serverpath(cmd_parms *cmd, void *dummy,
                                   const char *arg)
 {
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
 
     if (err != NULL) {
         return err;
@@ -2487,11 +2442,6 @@
 static const char *set_content_md5(cmd_parms *cmd, void *d_, int arg)
 {
     core_dir_config *d = d_;
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
-
-    if (err != NULL) {
-        return err;
-    }
 
     d->content_md5 = arg != 0;
     return NULL;
@@ -2521,11 +2471,6 @@
                                           const char *arg)
 {
     core_dir_config *d = d_;
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
-
-    if (err != NULL) {
-        return err;
-    }
 
     if (strcasecmp(arg, "on") == 0) {
         d->use_canonical_name = USE_CANONICAL_NAME_ON;
@@ -2547,11 +2492,6 @@
                                           const char *arg)
 {
     core_dir_config *d = d_;
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
-
-    if (err != NULL) {
-        return err;
-    }
 
     if (strcasecmp(arg, "on") == 0) {
         d->use_canonical_phys_port = USE_CANONICAL_PHYS_PORT_ON;
@@ -2620,8 +2560,7 @@
 {
     char *str;
 
-    const char *err = ap_check_cmd_context(cmd,
-                                           NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
     if (err != NULL) {
         return err;
     }
@@ -2838,8 +2777,7 @@
 static const char *set_limit_req_line(cmd_parms *cmd, void *dummy,
                                       const char *arg)
 {
-    const char *err = ap_check_cmd_context(cmd,
-                                           NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
     int lim;
 
     if (err != NULL) {
@@ -2859,8 +2797,7 @@
 static const char *set_limit_req_fieldsize(cmd_parms *cmd, void *dummy,
                                            const char *arg)
 {
-    const char *err = ap_check_cmd_context(cmd,
-                                           NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
     int lim;
 
     if (err != NULL) {
@@ -2881,8 +2818,7 @@
 static const char *set_limit_req_fields(cmd_parms *cmd, void *dummy,
                                         const char *arg)
 {
-    const char *err = ap_check_cmd_context(cmd,
-                                           NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
     int lim;
 
     if (err != NULL) {
@@ -2904,13 +2840,8 @@
                                       const char *arg)
 {
     core_dir_config *conf = conf_;
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
     char *errp;
 
-    if (err != NULL) {
-        return err;
-    }
-
     if (APR_SUCCESS != apr_strtoff(&conf->limit_req_body, arg, &errp, 10)) {
         return "LimitRequestBody argument is not parsable.";
     }
@@ -2925,11 +2856,6 @@
                                           const char *arg)
 {
     core_dir_config *conf = conf_;
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
-
-    if (err != NULL) {
-        return err;
-    }
 
     conf->limit_xml_body = atol(arg);
     if (conf->limit_xml_body < 0)