]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Log errors/infos during expression evaluation and associate the message
authorStefan Fritsch <sf@apache.org>
Sat, 20 Nov 2010 08:59:50 +0000 (08:59 +0000)
committerStefan Fritsch <sf@apache.org>
Sat, 20 Nov 2010 08:59:50 +0000 (08:59 +0000)
with the module that is calling ap_expr_exec()

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1037140 13f79535-47bb-0310-9956-ffa450edef68

modules/aaa/mod_authz_core.c
modules/filters/mod_filter.c
modules/loggers/mod_log_config.c
modules/metadata/mod_headers.c
modules/ssl/ssl_engine_config.c
server/core.c
server/util_expr_eval.c

index 73b13ab5308deebd66fcaeace060bf8ddd22f6ca..2fb89c6b49268e7badb3eda13bbafc1c4af94b54 100644 (file)
@@ -1008,6 +1008,7 @@ static const char *expr_parse_config(cmd_parms *cmd, const char *require_line,
     if (expr_err)
         return "Cannot parse expression in require line";
 
+    expr->module_index = APLOG_MODULE_INDEX;
     *parsed_require_line = expr;
 
     return NULL;
index 250c02d147287bf7f2a04827d442028dab20dfbe..eb81bffb67e76dd0c7c491b2623fb1fcd4269f77 100644 (file)
@@ -433,6 +433,7 @@ static const char *filter_provider(cmd_parms *cmd, void *CFG,
                            "Error parsing FilterProvider expression:", err,
                            NULL);
     }
+    node->module_index = APLOG_MODULE_INDEX;
 
     provider = apr_palloc(cmd->pool, sizeof(ap_filter_provider_t));
     provider->expr = node;
index 2225aef1e6372494928eb807cb04144f74511431..0b6c6f5a60d38ac1eecd1c8bf3ff1dce912a4d6d 100644 (file)
@@ -1256,6 +1256,7 @@ static const char *add_custom_log(cmd_parms *cmd, void *dummy, const char *fn,
                                                     NULL);
             if (err)
                 return err;
+           cls->condition_expr->module_index = APLOG_MODULE_INDEX;
         }
         else {
             return "error in condition clause";
index 505cb06eaeaad53f7bf203494468d8e236850fbb..b1948e02043bf76d23fa9fa737a9a3713fb8e544 100644 (file)
@@ -498,6 +498,7 @@ static APR_INLINE const char *header_inout_cmd(cmd_parms *cmd,
                                    "Can't parse envclause/expression: ", err,
                                    NULL);
             }
+            expr->module_index = APLOG_MODULE_INDEX;
         }
     }
 
index 0ed504422ef3a19c57b7dc6f95c0f96ae8cf79e0..4bccfe72d6b97311d6cb65b1a4af31c78d231bfb 100644 (file)
@@ -1154,6 +1154,7 @@ const char *ssl_cmd_SSLRequire(cmd_parms *cmd,
     info->flags = AP_EXPR_FLAGS_SSL_EXPR_COMPAT;
     info->filename = cmd->directive->filename;
     info->line_number = cmd->directive->line_num;
+    info->module_index = APLOG_MODULE_INDEX;
     errstring = ap_expr_parse(cmd->pool, cmd->temp_pool, info, arg, NULL);
     if (errstring) {
         return apr_pstrcat(cmd->pool, "SSLRequire: ", errstring, NULL);
index 83d75bfd3c1a67979f2b46532b2146b4dd4c4b12..ffeb98d9dc1c7a84f43a0fa81bb315615251f620 100644 (file)
@@ -2043,6 +2043,7 @@ static const char *ifsection(cmd_parms *cmd, void *mconfig, const char *arg)
     if (expr_err) {
         return apr_psprintf(cmd->pool, "Cannot parse condition clause: %s", expr_err);
     }
+    conf->condition->module_index = APLOG_MODULE_INDEX;
 
     errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_file_conf);
     if (errmsg != NULL)
index c136b50d37e23e72e1be27910f1543e65bc898a0..edb1b7d7f7987e43140e8bf7a56e3a803e18baad 100644 (file)
@@ -687,10 +687,18 @@ AP_DECLARE(int) ap_expr_exec(request_rec *r, const ap_expr_info_t *info, const c
 
     *err = NULL;
     rc = ap_expr_eval(&ctx, info->root_node);
-    if (*err != NULL)
-        return (-1);
-    else
-        return (rc ? 1 : 0);
+    if (*err != NULL) {
+        ap_log_rerror(__FILE__, __LINE__, info->module_index, APLOG_ERR, 0,
+                      r, "Evaluation of expression from %s:%d failed: %s",
+                      info->filename, info->line_number, *err);
+        return -1;
+    } else {
+        rc = rc ? 1 : 0;
+        ap_log_rerror(__FILE__, __LINE__, info->module_index, APLOG_TRACE4, 0,
+                      r, "Evaluation of expression from %s:%d gave: %d",
+                      info->filename, info->line_number, rc);
+        return rc;
+    }
 }
 
 static const char *req_table_func(ap_expr_eval_ctx *ctx, const void *data,