summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-10-17 01:27:52 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2020-05-23 17:59:29 -0400
commit36f64b26a11500ac720dad148481a1a0e66a8ba7 (patch)
treec978431d0ddffe72cb9888cf7eda83dab48607d0
parentb6e0880ae6a92991a13d3297bbf2e2ac5159e6b6 (diff)
downloadlighttpd-git-36f64b26a11500ac720dad148481a1a0e66a8ba7.tar.gz
[core] simpler config_check_cond()
optimize for common case where condition has been evaluated for the request and a cached result exists (also: begin isolating data_config)
-rw-r--r--src/configfile-glue.c30
-rw-r--r--src/configfile.c5
-rw-r--r--src/configfile.h2
-rw-r--r--src/mod_access.c5
-rw-r--r--src/mod_accesslog.c5
-rw-r--r--src/mod_alias.c5
-rw-r--r--src/mod_auth.c5
-rw-r--r--src/mod_authn_file.c5
-rw-r--r--src/mod_authn_gssapi.c5
-rw-r--r--src/mod_authn_ldap.c5
-rw-r--r--src/mod_authn_mysql.c5
-rw-r--r--src/mod_authn_pam.c5
-rw-r--r--src/mod_authn_sasl.c5
-rw-r--r--src/mod_cgi.c5
-rw-r--r--src/mod_cml.c5
-rw-r--r--src/mod_compress.c5
-rw-r--r--src/mod_deflate.c5
-rw-r--r--src/mod_dirlisting.c5
-rw-r--r--src/mod_evasive.c5
-rw-r--r--src/mod_evhost.c5
-rw-r--r--src/mod_expire.c5
-rw-r--r--src/mod_extforward.c5
-rw-r--r--src/mod_fastcgi.c5
-rw-r--r--src/mod_flv_streaming.c5
-rw-r--r--src/mod_geoip.c5
-rw-r--r--src/mod_indexfile.c5
-rw-r--r--src/mod_magnet.c5
-rw-r--r--src/mod_maxminddb.c5
-rw-r--r--src/mod_mysql_vhost.c5
-rw-r--r--src/mod_openssl.c5
-rw-r--r--src/mod_proxy.c5
-rw-r--r--src/mod_redirect.c5
-rw-r--r--src/mod_rewrite.c5
-rw-r--r--src/mod_rrdtool.c5
-rw-r--r--src/mod_scgi.c5
-rw-r--r--src/mod_secdownload.c5
-rw-r--r--src/mod_setenv.c5
-rw-r--r--src/mod_simple_vhost.c5
-rw-r--r--src/mod_skeleton.c5
-rw-r--r--src/mod_sockproxy.c5
-rw-r--r--src/mod_ssi.c5
-rw-r--r--src/mod_staticfile.c5
-rw-r--r--src/mod_status.c5
-rw-r--r--src/mod_trigger_b4_dl.c5
-rw-r--r--src/mod_uploadprogress.c5
-rw-r--r--src/mod_userdir.c5
-rw-r--r--src/mod_usertrack.c5
-rw-r--r--src/mod_vhostdb.c5
-rw-r--r--src/mod_vhostdb_dbi.c5
-rw-r--r--src/mod_vhostdb_ldap.c5
-rw-r--r--src/mod_vhostdb_mysql.c5
-rw-r--r--src/mod_vhostdb_pgsql.c5
-rw-r--r--src/mod_webdav.c5
-rw-r--r--src/mod_wstunnel.c6
54 files changed, 126 insertions, 167 deletions
diff --git a/src/configfile-glue.c b/src/configfile-glue.c
index 0f1e4e88..fea63452 100644
--- a/src/configfile-glue.c
+++ b/src/configfile-glue.c
@@ -503,6 +503,27 @@ static cond_result_t config_check_cond_cached(connection *con, const data_config
return cache->result;
}
+__attribute_noinline__
+static cond_result_t config_check_cond_calc(connection *con, const int context_ndx) {
+ const data_config * const dc = (const data_config *)
+ con->srv->config_context->data[context_ndx];
+ const int debug_cond = con->conf.log_condition_handling;
+ if (debug_cond) {
+ log_error(con->errh, __FILE__, __LINE__,
+ "=== start of condition block ===");
+ }
+ return config_check_cond_cached(con, dc, debug_cond);
+}
+
+/* future: might make static inline in header for plugins */
+int config_check_cond(connection * const con, const int context_ndx) {
+ const cond_cache_t * const cache = &con->cond_cache[context_ndx];
+ return COND_RESULT_TRUE
+ == (COND_RESULT_UNSET != cache->result
+ ? cache->result
+ : config_check_cond_calc(con, context_ndx));
+}
+
/* if we reset the cache result for a node, we also need to clear all
* child nodes and else-branches*/
static void config_cond_clear_node(server *srv, connection *con, const data_config *dc) {
@@ -567,15 +588,6 @@ void config_cond_cache_reset(server *srv, connection *con) {
}
}
-int config_check_cond(server *srv, connection *con, const data_config *dc) {
- UNUSED(srv);
- const int debug_cond = con->conf.log_condition_handling;
- if (debug_cond) {
- log_error(con->errh, __FILE__, __LINE__, "=== start of condition block ===");
- }
- return (config_check_cond_cached(con, dc, debug_cond) == COND_RESULT_TRUE);
-}
-
#ifdef HAVE_PCRE_H
#include <pcre.h>
#endif
diff --git a/src/configfile.c b/src/configfile.c
index 8fb3754c..0c0d756a 100644
--- a/src/configfile.c
+++ b/src/configfile.c
@@ -684,12 +684,11 @@ void config_patch_connection(server *srv, connection *con) {
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
specific_config *s = srv->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/configfile.h b/src/configfile.h
index 8a4cf6ee..6c4647ee 100644
--- a/src/configfile.h
+++ b/src/configfile.h
@@ -152,6 +152,6 @@ int config_insert_values_global(server *srv, const array *ca, const config_value
__attribute_cold__
int config_insert_values_internal(server *srv, const array *ca, const config_values_t *cv, config_scope_type_t scope);
-int config_check_cond(server *srv, connection *con, const data_config *dc);
+int config_check_cond(connection *con, int context_ndx);
#endif
diff --git a/src/mod_access.c b/src/mod_access.c
index 9dcaf1bb..280127f6 100644
--- a/src/mod_access.c
+++ b/src/mod_access.c
@@ -113,12 +113,11 @@ static int mod_access_patch_connection(server *srv, connection *con, plugin_data
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_accesslog.c b/src/mod_accesslog.c
index 81714003..092bc678 100644
--- a/src/mod_accesslog.c
+++ b/src/mod_accesslog.c
@@ -723,12 +723,11 @@ static int mod_accesslog_patch_connection(server *srv, connection *con, plugin_d
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_alias.c b/src/mod_alias.c
index 55b591ca..33f02890 100644
--- a/src/mod_alias.c
+++ b/src/mod_alias.c
@@ -137,12 +137,11 @@ static int mod_alias_patch_connection(server *srv, connection *con, plugin_data
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_auth.c b/src/mod_auth.c
index 201f2f7a..2777fda2 100644
--- a/src/mod_auth.c
+++ b/src/mod_auth.c
@@ -437,12 +437,11 @@ static int mod_auth_patch_connection(server *srv, connection *con, plugin_data *
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_authn_file.c b/src/mod_authn_file.c
index 01142230..c6f1bf51 100644
--- a/src/mod_authn_file.c
+++ b/src/mod_authn_file.c
@@ -170,12 +170,11 @@ static int mod_authn_file_patch_connection(server *srv, connection *con, plugin_
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_authn_gssapi.c b/src/mod_authn_gssapi.c
index d23d03b2..3897e9cd 100644
--- a/src/mod_authn_gssapi.c
+++ b/src/mod_authn_gssapi.c
@@ -146,12 +146,11 @@ static int mod_authn_gssapi_patch_connection(server *srv, connection *con, plugi
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_authn_ldap.c b/src/mod_authn_ldap.c
index fd4d5eb1..4c810cc2 100644
--- a/src/mod_authn_ldap.c
+++ b/src/mod_authn_ldap.c
@@ -204,12 +204,11 @@ static int mod_authn_ldap_patch_connection(server *srv, connection *con, plugin_
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_authn_mysql.c b/src/mod_authn_mysql.c
index 11339160..6e41c5fb 100644
--- a/src/mod_authn_mysql.c
+++ b/src/mod_authn_mysql.c
@@ -294,12 +294,11 @@ static int mod_authn_mysql_patch_connection(server *srv, connection *con, plugin
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_authn_pam.c b/src/mod_authn_pam.c
index 0ce1fb3c..7b7cbbea 100644
--- a/src/mod_authn_pam.c
+++ b/src/mod_authn_pam.c
@@ -108,10 +108,9 @@ static int mod_authn_pam_patch_connection(server *srv, connection *con, plugin_d
/* skip the first, the global context */
for (size_t i = 1; i < srv->config_context->used; ++i) {
- data_config *dc = (data_config *)srv->config_context->data[i];
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
+ data_config *dc = (data_config *)srv->config_context->data[i];
/* merge config */
s = p->config_storage[i];
diff --git a/src/mod_authn_sasl.c b/src/mod_authn_sasl.c
index 949ba481..4a8b162a 100644
--- a/src/mod_authn_sasl.c
+++ b/src/mod_authn_sasl.c
@@ -160,10 +160,9 @@ static int mod_authn_sasl_patch_connection(server *srv, connection *con, plugin_
/* skip the first, the global context */
for (size_t i = 1; i < srv->config_context->used; ++i) {
- data_config *dc = (data_config *)srv->config_context->data[i];
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
+ data_config *dc = (data_config *)srv->config_context->data[i];
/* merge config */
s = p->config_storage[i];
diff --git a/src/mod_cgi.c b/src/mod_cgi.c
index b7c49d05..89bc0ce5 100644
--- a/src/mod_cgi.c
+++ b/src/mod_cgi.c
@@ -874,12 +874,11 @@ static int mod_cgi_patch_connection(server *srv, connection *con, plugin_data *p
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_cml.c b/src/mod_cml.c
index ee87a8f1..8b26d5f5 100644
--- a/src/mod_cml.c
+++ b/src/mod_cml.c
@@ -169,12 +169,11 @@ static int mod_cml_patch_connection(server *srv, connection *con, plugin_data *p
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_compress.c b/src/mod_compress.c
index 204c5ceb..b14e2067 100644
--- a/src/mod_compress.c
+++ b/src/mod_compress.c
@@ -755,12 +755,11 @@ static int mod_compress_patch_connection(server *srv, connection *con, plugin_da
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_deflate.c b/src/mod_deflate.c
index aed374f8..5a03fcb3 100644
--- a/src/mod_deflate.c
+++ b/src/mod_deflate.c
@@ -955,12 +955,11 @@ static int mod_deflate_patch_connection(server *srv, connection *con, plugin_dat
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_dirlisting.c b/src/mod_dirlisting.c
index 2663bfb1..98c5ba99 100644
--- a/src/mod_dirlisting.c
+++ b/src/mod_dirlisting.c
@@ -358,12 +358,11 @@ static int mod_dirlisting_patch_connection(server *srv, connection *con, plugin_
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_evasive.c b/src/mod_evasive.c
index 93e86c2c..d7b8a693 100644
--- a/src/mod_evasive.c
+++ b/src/mod_evasive.c
@@ -122,12 +122,11 @@ static int mod_evasive_patch_connection(server *srv, connection *con, plugin_dat
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_evhost.c b/src/mod_evhost.c
index 4217ee02..e5bb985d 100644
--- a/src/mod_evhost.c
+++ b/src/mod_evhost.c
@@ -263,12 +263,11 @@ static int mod_evhost_patch_connection(server *srv, connection *con, plugin_data
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_expire.c b/src/mod_expire.c
index 5f494f17..bfa44574 100644
--- a/src/mod_expire.c
+++ b/src/mod_expire.c
@@ -302,12 +302,11 @@ static int mod_expire_patch_connection(server *srv, connection *con, plugin_data
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_extforward.c b/src/mod_extforward.c
index 2668b005..81f2dbb2 100644
--- a/src/mod_extforward.c
+++ b/src/mod_extforward.c
@@ -387,12 +387,11 @@ static int mod_extforward_patch_connection(server *srv, connection *con, plugin_
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c
index c6fa1b6c..a188960c 100644
--- a/src/mod_fastcgi.c
+++ b/src/mod_fastcgi.c
@@ -452,12 +452,11 @@ static int fcgi_patch_connection(server *srv, connection *con, plugin_data *p) {
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_flv_streaming.c b/src/mod_flv_streaming.c
index 950a485f..4cf09a83 100644
--- a/src/mod_flv_streaming.c
+++ b/src/mod_flv_streaming.c
@@ -97,12 +97,11 @@ static int mod_flv_streaming_patch_connection(server *srv, connection *con, plug
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_geoip.c b/src/mod_geoip.c
index 69ffb8f1..13e307b2 100644
--- a/src/mod_geoip.c
+++ b/src/mod_geoip.c
@@ -188,12 +188,11 @@ static int mod_geoip_patch_connection(server *srv, connection *con, plugin_data
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_indexfile.c b/src/mod_indexfile.c
index eb0095bb..f9280c37 100644
--- a/src/mod_indexfile.c
+++ b/src/mod_indexfile.c
@@ -121,12 +121,11 @@ static int mod_indexfile_patch_connection(server *srv, connection *con, plugin_d
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_magnet.c b/src/mod_magnet.c
index 53d32f56..8d8911f7 100644
--- a/src/mod_magnet.c
+++ b/src/mod_magnet.c
@@ -149,12 +149,11 @@ static int mod_magnet_patch_connection(server *srv, connection *con, plugin_data
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_maxminddb.c b/src/mod_maxminddb.c
index d5e477e1..519187fb 100644
--- a/src/mod_maxminddb.c
+++ b/src/mod_maxminddb.c
@@ -333,10 +333,9 @@ mod_maxmind_patch_connection (server * const srv,
s = p->config_storage[1]; /* base config (global context) copied above */
for (size_t i = 1; i < srv->config_context->used; ++i) {
- data_config *dc = context_data[i];
- if (!config_check_cond(srv, con, dc))
- continue; /* condition did not match */
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+ data_config *dc = context_data[i];
s = p->config_storage[i];
/* merge config */
diff --git a/src/mod_mysql_vhost.c b/src/mod_mysql_vhost.c
index 4bf122f3..5430c26c 100644
--- a/src/mod_mysql_vhost.c
+++ b/src/mod_mysql_vhost.c
@@ -240,12 +240,11 @@ static int mod_mysql_vhost_patch_connection(server *srv, connection *con, plugin
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_openssl.c b/src/mod_openssl.c
index 63768b2b..e04d8416 100644
--- a/src/mod_openssl.c
+++ b/src/mod_openssl.c
@@ -1391,12 +1391,11 @@ mod_openssl_patch_connection (server *srv, connection *con, handler_ctx *hctx)
/* skip the first, the global context */
for (size_t i = 1; i < srv->config_context->used; ++i) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = plugin_data_singleton->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (size_t j = 0; j < dc->value->used; ++j) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_proxy.c b/src/mod_proxy.c
index ad9b28b1..01d84526 100644
--- a/src/mod_proxy.c
+++ b/src/mod_proxy.c
@@ -890,12 +890,11 @@ static int mod_proxy_patch_connection(server *srv, connection *con, plugin_data
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_redirect.c b/src/mod_redirect.c
index 37ede72e..698dcbe8 100644
--- a/src/mod_redirect.c
+++ b/src/mod_redirect.c
@@ -124,12 +124,11 @@ static int mod_redirect_patch_connection(server *srv, connection *con, plugin_da
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_rewrite.c b/src/mod_rewrite.c
index 951d773d..ef25db56 100644
--- a/src/mod_rewrite.c
+++ b/src/mod_rewrite.c
@@ -173,12 +173,11 @@ static int mod_rewrite_patch_connection(server *srv, connection *con, plugin_dat
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_rrdtool.c b/src/mod_rrdtool.c
index 876dafa5..794b79a6 100644
--- a/src/mod_rrdtool.c
+++ b/src/mod_rrdtool.c
@@ -255,12 +255,11 @@ static int mod_rrd_patch_connection(server *srv, connection *con, plugin_data *p
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_scgi.c b/src/mod_scgi.c
index 80aa682d..8c801f84 100644
--- a/src/mod_scgi.c
+++ b/src/mod_scgi.c
@@ -241,12 +241,11 @@ static int scgi_patch_connection(server *srv, connection *con, plugin_data *p) {
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_secdownload.c b/src/mod_secdownload.c
index fba53c47..b4cf6eb3 100644
--- a/src/mod_secdownload.c
+++ b/src/mod_secdownload.c
@@ -407,12 +407,11 @@ static int mod_secdownload_patch_connection(server *srv, connection *con, plugin
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_setenv.c b/src/mod_setenv.c
index 6f5c6528..e5339c5f 100644
--- a/src/mod_setenv.c
+++ b/src/mod_setenv.c
@@ -166,12 +166,11 @@ static int mod_setenv_patch_connection(server *srv, connection *con, plugin_data
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_simple_vhost.c b/src/mod_simple_vhost.c
index ef456c4f..89e25481 100644
--- a/src/mod_simple_vhost.c
+++ b/src/mod_simple_vhost.c
@@ -190,12 +190,11 @@ static int mod_simple_vhost_patch_connection(server *srv, connection *con, plugi
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_skeleton.c b/src/mod_skeleton.c
index c10954f1..35f59bf9 100644
--- a/src/mod_skeleton.c
+++ b/src/mod_skeleton.c
@@ -125,12 +125,11 @@ static int mod_skeleton_patch_connection(server *srv, connection *con, plugin_da
/* skip the first, the global context */
for (size_t i = 1; i < srv->config_context->used; ++i) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (size_t j = 0; j < dc->value->used; ++j) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_sockproxy.c b/src/mod_sockproxy.c
index 4e5b62b3..32761191 100644
--- a/src/mod_sockproxy.c
+++ b/src/mod_sockproxy.c
@@ -107,12 +107,11 @@ static int mod_sockproxy_patch_connection(server *srv, connection *con, plugin_d
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_ssi.c b/src/mod_ssi.c
index 17666052..d2e3eb4f 100644
--- a/src/mod_ssi.c
+++ b/src/mod_ssi.c
@@ -1272,12 +1272,11 @@ static int mod_ssi_patch_connection(server *srv, connection *con, plugin_data *p
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_staticfile.c b/src/mod_staticfile.c
index 68da1857..3e1e85be 100644
--- a/src/mod_staticfile.c
+++ b/src/mod_staticfile.c
@@ -130,12 +130,11 @@ static int mod_staticfile_patch_connection(server *srv, connection *con, plugin_
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_status.c b/src/mod_status.c
index a89ab3bf..91cdf6d5 100644
--- a/src/mod_status.c
+++ b/src/mod_status.c
@@ -864,12 +864,11 @@ static int mod_status_patch_connection(server *srv, connection *con, plugin_data
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_trigger_b4_dl.c b/src/mod_trigger_b4_dl.c
index 6dbf4bb7..9a817a5b 100644
--- a/src/mod_trigger_b4_dl.c
+++ b/src/mod_trigger_b4_dl.c
@@ -282,12 +282,11 @@ static int mod_trigger_b4_dl_patch_connection(server *srv, connection *con, plug
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_uploadprogress.c b/src/mod_uploadprogress.c
index 418926b2..dae3e4f3 100644
--- a/src/mod_uploadprogress.c
+++ b/src/mod_uploadprogress.c
@@ -227,12 +227,11 @@ static int mod_uploadprogress_patch_connection(server *srv, connection *con, plu
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_userdir.c b/src/mod_userdir.c
index 097d2315..038c2eeb 100644
--- a/src/mod_userdir.c
+++ b/src/mod_userdir.c
@@ -161,12 +161,11 @@ static int mod_userdir_patch_connection(server *srv, connection *con, plugin_dat
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_usertrack.c b/src/mod_usertrack.c
index 86faa3b8..f0d861b5 100644
--- a/src/mod_usertrack.c
+++ b/src/mod_usertrack.c
@@ -155,12 +155,11 @@ static int mod_usertrack_patch_connection(server *srv, connection *con, plugin_d
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_vhostdb.c b/src/mod_vhostdb.c
index 5d101d37..192c22e8 100644
--- a/src/mod_vhostdb.c
+++ b/src/mod_vhostdb.c
@@ -103,12 +103,11 @@ static int mod_vhostdb_patch_connection(server *srv, connection *con, plugin_dat
/* skip the first, the global context */
for (size_t i = 1; i < srv->config_context->used; ++i) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (size_t j = 0; j < dc->value->used; ++j) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_vhostdb_dbi.c b/src/mod_vhostdb_dbi.c
index d7f04a18..327bbc3e 100644
--- a/src/mod_vhostdb_dbi.c
+++ b/src/mod_vhostdb_dbi.c
@@ -298,12 +298,11 @@ static void mod_vhostdb_patch_connection (server *srv, connection *con, plugin_d
/* skip the first, the global context */
for (size_t i = 1; i < srv->config_context->used; ++i) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (size_t j = 0; j < dc->value->used; ++j) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_vhostdb_ldap.c b/src/mod_vhostdb_ldap.c
index e2f55af8..e8eea3ec 100644
--- a/src/mod_vhostdb_ldap.c
+++ b/src/mod_vhostdb_ldap.c
@@ -526,12 +526,11 @@ static void mod_vhostdb_patch_connection (server *srv, connection *con, plugin_d
/* skip the first, the global context */
for (size_t i = 1; i < srv->config_context->used; ++i) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (size_t j = 0; j < dc->value->used; ++j) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_vhostdb_mysql.c b/src/mod_vhostdb_mysql.c
index 7111e1b8..e617188a 100644
--- a/src/mod_vhostdb_mysql.c
+++ b/src/mod_vhostdb_mysql.c
@@ -262,12 +262,11 @@ static void mod_vhostdb_patch_connection (server *srv, connection *con, plugin_d
/* skip the first, the global context */
for (size_t i = 1; i < srv->config_context->used; ++i) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (size_t j = 0; j < dc->value->used; ++j) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_vhostdb_pgsql.c b/src/mod_vhostdb_pgsql.c
index da0dbc11..36182213 100644
--- a/src/mod_vhostdb_pgsql.c
+++ b/src/mod_vhostdb_pgsql.c
@@ -239,12 +239,11 @@ static void mod_vhostdb_patch_connection (server *srv, connection *con, plugin_d
/* skip the first, the global context */
for (size_t i = 1; i < srv->config_context->used; ++i) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) continue;
-
/* merge config */
for (size_t j = 0; j < dc->value->used; ++j) {
data_unset *du = dc->value->data[j];
diff --git a/src/mod_webdav.c b/src/mod_webdav.c
index ffb46f24..9229441f 100644
--- a/src/mod_webdav.c
+++ b/src/mod_webdav.c
@@ -481,10 +481,9 @@ mod_webdav_patch_connection (server * const restrict srv,
(data_config **)srv->config_context->data;
for (size_t i = 1; i < srv->config_context->used; ++i) {
- data_config * const dc = context_data[i];
- if (!config_check_cond(srv, con, dc))
- continue; /* condition did not match */
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+ data_config * const dc = context_data[i];
s = p->config_storage[i];
/* merge config */
diff --git a/src/mod_wstunnel.c b/src/mod_wstunnel.c
index a619e963..6b20d78b 100644
--- a/src/mod_wstunnel.c
+++ b/src/mod_wstunnel.c
@@ -371,13 +371,11 @@ static void mod_wstunnel_patch_connection(server *srv, connection *con, plugin_d
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
+ if (!config_check_cond(con, i)) continue; /* condition not matched */
+
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
- /* condition didn't match */
- if (!config_check_cond(srv, con, dc)) {
- continue;
- }
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];