[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-cvs
Subject:    svn commit: r1905170 - /httpd/httpd/trunk/modules/dav/main/mod_dav.c
From:       manu () apache ! org
Date:       2022-11-09 1:12:26
Message-ID: 20221109011226.BC67B17AC85 () svn01-us-east ! apache ! org
[Download RAW message or body]

Author: manu
Date: Wed Nov  9 01:12:26 2022
New Revision: 1905170

URL: http://svn.apache.org/viewvc?rev=1905170&view=rev
Log:
Turn DavLockDiscovery into a flag

As requested on dev@httpd.apache.org, turn DavLockDiscovery into a Flag.
Expressions can still be used by enclosing the directive by 
<If "expr">...</If>


Modified:
    httpd/httpd/trunk/modules/dav/main/mod_dav.c

Modified: httpd/httpd/trunk/modules/dav/main/mod_dav.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/main/mod_dav.c?rev=1905170&r1=1905169&r2=1905170&view=diff
 ==============================================================================
--- httpd/httpd/trunk/modules/dav/main/mod_dav.c (original)
+++ httpd/httpd/trunk/modules/dav/main/mod_dav.c Wed Nov  9 01:12:26 2022
@@ -83,7 +83,7 @@ typedef struct {
     const char *dir;
     int locktimeout;
     int allow_depthinfinity;
-    ap_expr_info_t *allow_lockdiscovery;
+    int allow_lockdiscovery;
 
 } dav_dir_conf;
 
@@ -160,6 +160,8 @@ static void *dav_create_dir_config(apr_p
 
     conf = (dav_dir_conf *)apr_pcalloc(p, sizeof(*conf));
 
+    conf->allow_lockdiscovery = DAV_ENABLED_ON;
+
     /* clean up the directory to remove any trailing slash */
     if (dir != NULL) {
         char *d;
@@ -304,26 +306,17 @@ static const char *dav_cmd_davdepthinfin
 }
 
 /*
- * Command handler for the DAVLockDiscovery directive, which is TAKE1.
+ * Command handler for the DAVLockDiscovery directive, which is FLAG.
  */
 static const char *dav_cmd_davlockdiscovery(cmd_parms *cmd, void *config,
-                                            const char *arg)
+                                            int arg)
 {
     dav_dir_conf *conf = (dav_dir_conf *)config;
 
-    if (strncasecmp(arg, "expr=", 5) == 0) {
-        const char *err;
-        if ((arg[5] == '\0'))
-            return "missing condition";
-        conf->allow_lockdiscovery = ap_expr_parse_cmd(cmd, &arg[5],
-                                                      AP_EXPR_FLAG_DONT_VARY,
-                                                      &err, NULL);
-        if (err)
-            return err;
-    } else {
-        return "error in condition clause";
-    }
-
+    if (arg)
+        conf->allow_lockdiscovery = DAV_ENABLED_ON;
+    else
+        conf->allow_lockdiscovery = DAV_ENABLED_OFF;
     return NULL;
 }
 
@@ -2098,18 +2091,8 @@ static dav_error * dav_propfind_walker(d
     }
 
     conf = ap_get_module_config(ctx->r->per_dir_config, &dav_module);
-    if (conf && conf->allow_lockdiscovery) {
-            const char *errstr = NULL;
-            int eval = ap_expr_exec(ctx->r, conf->allow_lockdiscovery, &errstr);
-            if (errstr) {
-                ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r, APLOGNO(10403)
-                              "Failed to evaluate expression (%s) - ignoring",
-                              errstr);
-            } else {
-                if (!eval) 
-                    flags |= DAV_PROPDB_DISABLE_LOCKDISCOVERY;
-            }
-    }
+    if (conf && conf->allow_lockdiscovery == DAV_ENABLED_OFF)
+        flags |= DAV_PROPDB_DISABLE_LOCKDISCOVERY;
 
     /*
     ** Note: ctx->doc can only be NULL for DAV_PROPFIND_IS_ALLPROP. Since
@@ -5265,9 +5248,9 @@ static const command_rec dav_cmds[] =
                  "allow Depth infinity PROPFIND requests"),
 
     /* per directory/location, or per server */
-    AP_INIT_TAKE1("DAVLockDiscovery", dav_cmd_davlockdiscovery, NULL,
-                  ACCESS_CONF|RSRC_CONF,
-                  "allow lock discovery by PROPFIND requests"),
+    AP_INIT_FLAG("DAVLockDiscovery", dav_cmd_davlockdiscovery, NULL,
+                 ACCESS_CONF|RSRC_CONF,
+                 "allow lock discovery by PROPFIND requests"),
 
     { NULL }
 };


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic