Browse Source

removed setup_connection (merged [295])

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@512 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.2
Jan Kneschke 17 years ago
parent
commit
c8408d015c
  1. 32
      src/mod_access.c
  2. 43
      src/mod_accesslog.c
  3. 29
      src/mod_alias.c
  4. 29
      src/mod_cgi.c
  5. 36
      src/mod_cml.c
  6. 31
      src/mod_compress.c
  7. 29
      src/mod_evhost.c
  8. 29
      src/mod_expire.c
  9. 32
      src/mod_fastcgi.c
  10. 35
      src/mod_mysql_vhost.c
  11. 42
      src/mod_proxy.c
  12. 28
      src/mod_redirect.c
  13. 29
      src/mod_rewrite.c
  14. 38
      src/mod_rrdtool.c
  15. 31
      src/mod_scgi.c
  16. 33
      src/mod_secure_download.c
  17. 31
      src/mod_setenv.c
  18. 40
      src/mod_simple_vhost.c
  19. 27
      src/mod_skeleton.c
  20. 29
      src/mod_ssi.c
  21. 39
      src/mod_status.c
  22. 42
      src/mod_trigger_b4_dl.c
  23. 32
      src/mod_userdir.c
  24. 3
      src/stream.c

32
src/mod_access.c

@ -85,16 +85,16 @@ SETDEFAULTS_FUNC(mod_access_set_defaults) {
#define PATCH(x) \
p->conf.x = s->x;
static int mod_access_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_access_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(access_deny);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -111,34 +111,16 @@ static int mod_access_patch_connection(server *srv, connection *con, plugin_data
return 0;
}
static int mod_access_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(access_deny);
return 0;
}
#undef PATCH
URIHANDLER_FUNC(mod_access_uri_handler) {
plugin_data *p = p_d;
int s_len;
size_t k, i;
size_t k;
UNUSED(srv);
if (con->uri.path->used == 0) return HANDLER_GO_ON;
mod_access_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_access_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_access_patch_connection(srv, con, p);
s_len = con->uri.path->used - 1;

43
src/mod_accesslog.c

@ -563,16 +563,23 @@ SIGHUP_FUNC(log_access_cycle) {
#define PATCH(x) \
p->conf.x = s->x;
static int mod_accesslog_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_accesslog_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(access_logfile);
PATCH(format);
PATCH(log_access_fd);
PATCH(last_generated_accesslog_ts_ptr);
PATCH(access_logbuffer);
PATCH(ts_accesslog_str);
PATCH(parsed_format);
PATCH(use_syslog);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -598,38 +605,16 @@ static int mod_accesslog_patch_connection(server *srv, connection *con, plugin_d
return 0;
}
static int mod_accesslog_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(access_logfile);
PATCH(format);
PATCH(log_access_fd);
PATCH(last_generated_accesslog_ts_ptr);
PATCH(access_logbuffer);
PATCH(ts_accesslog_str);
PATCH(parsed_format);
PATCH(use_syslog);
return 0;
}
#undef PATCH
REQUESTDONE_FUNC(log_access_write) {
plugin_data *p = p_d;
size_t j, i;
size_t j;
int newts = 0;
data_string *ds;
mod_accesslog_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_accesslog_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_accesslog_patch_connection(srv, con, p);
if (p->conf.access_logbuffer->used == 0) {
buffer_copy_string(p->conf.access_logbuffer, "");

29
src/mod_alias.c

@ -93,16 +93,16 @@ SETDEFAULTS_FUNC(mod_alias_set_defaults) {
#define PATCH(x) \
p->conf.x = s->x;
static int mod_alias_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_alias_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(alias);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -119,32 +119,17 @@ static int mod_alias_patch_connection(server *srv, connection *con, plugin_data
return 0;
}
static int mod_alias_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(alias);
return 0;
}
#undef PATCH
PHYSICALPATH_FUNC(mod_alias_physical_handler) {
plugin_data *p = p_d;
int uri_len, basedir_len;
char *uri_ptr;
size_t k, i;
size_t k;
if (con->physical.path->used == 0) return HANDLER_GO_ON;
mod_alias_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_alias_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_alias_patch_connection(srv, con, p);
/* not to include the tailing slash */
basedir_len = (con->physical.basedir->used - 1) - 1;

29
src/mod_cgi.c

@ -1001,16 +1001,16 @@ static int cgi_create_env(server *srv, connection *con, plugin_data *p, buffer *
#define PATCH(x) \
p->conf.x = s->x;
static int mod_cgi_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_cgi_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(cgi);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -1027,31 +1027,16 @@ static int mod_cgi_patch_connection(server *srv, connection *con, plugin_data *p
return 0;
}
static int mod_cgi_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(cgi);
return 0;
}
#undef PATCH
URIHANDLER_FUNC(cgi_is_handled) {
size_t k, s_len, i;
size_t k, s_len;
plugin_data *p = p_d;
buffer *fn = con->physical.path;
if (fn->used == 0) return HANDLER_ERROR;
mod_cgi_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_cgi_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_cgi_patch_connection(srv, con, p);
s_len = fn->used - 1;

36
src/mod_cml.c

@ -135,16 +135,20 @@ SETDEFAULTS_FUNC(mod_cml_set_defaults) {
#define PATCH(x) \
p->conf.x = s->x;
static int mod_cml_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_cml_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(ext);
#if defined(HAVE_MEMCACHE_H)
PATCH(mc);
#endif
PATCH(mc_namespace);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -167,20 +171,6 @@ static int mod_cml_patch_connection(server *srv, connection *con, plugin_data *p
return 0;
}
static int mod_cml_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(ext);
#if defined(HAVE_MEMCACHE_H)
PATCH(mc);
#endif
PATCH(mc_namespace);
return 0;
}
#undef PATCH
@ -313,17 +303,11 @@ URIHANDLER_FUNC(mod_cml_is_handled) {
char *c;
buffer *fn = con->physical.path;
plugin_data *p = p_d;
size_t i;
int ret;
if (fn->used == 0) return HANDLER_ERROR;
mod_cml_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_cml_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_cml_patch_connection(srv, con, p);
buffer_reset(p->basedir);
buffer_reset(p->baseurl);

31
src/mod_compress.c

@ -526,16 +526,18 @@ static int deflate_file_to_buffer(server *srv, connection *con, plugin_data *p,
#define PATCH(x) \
p->conf.x = s->x;
static int mod_compress_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_compress_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(compress_cache_dir);
PATCH(compress);
PATCH(compress_max_filesize);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -556,18 +558,6 @@ static int mod_compress_patch_connection(server *srv, connection *con, plugin_da
return 0;
}
static int mod_compress_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(compress_cache_dir);
PATCH(compress);
PATCH(compress_max_filesize);
return 0;
}
#undef PATCH
PHYSICALPATH_FUNC(mod_compress_physical) {
@ -583,12 +573,7 @@ PHYSICALPATH_FUNC(mod_compress_physical) {
return HANDLER_GO_ON;
}
mod_compress_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_compress_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_compress_patch_connection(srv, con, p);
max_fsize = p->conf.compress_max_filesize;

29
src/mod_evhost.c

@ -220,16 +220,17 @@ static int mod_evhost_parse_host(connection *con,array *host) {
#define PATCH(x) \
p->conf.x = s->x;
static int mod_evhost_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_evhost_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(path_pieces);
PATCH(len);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -247,17 +248,6 @@ static int mod_evhost_patch_connection(server *srv, connection *con, plugin_data
return 0;
}
static int mod_evhost_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(path_pieces);
PATCH(len);
return 0;
}
#undef PATCH
@ -272,12 +262,7 @@ static handler_t mod_evhost_uri_handler(server *srv, connection *con, void *p_d)
/* not authority set */
if (con->uri.authority->used == 0) return HANDLER_GO_ON;
mod_evhost_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_evhost_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_evhost_patch_connection(srv, con, p);
parsed_host = array_init();

29
src/mod_expire.c

@ -249,16 +249,16 @@ SETDEFAULTS_FUNC(mod_expire_set_defaults) {
#define PATCH(x) \
p->conf.x = s->x;
static int mod_expire_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_expire_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(expire_url);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -275,31 +275,16 @@ static int mod_expire_patch_connection(server *srv, connection *con, plugin_data
return 0;
}
static int mod_expire_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(expire_url);
return 0;
}
#undef PATCH
URIHANDLER_FUNC(mod_expire_path_handler) {
plugin_data *p = p_d;
int s_len;
size_t k, i;
size_t k;
if (con->uri.path->used == 0) return HANDLER_GO_ON;
mod_expire_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_expire_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_expire_patch_connection(srv, con, p);
s_len = con->uri.path->used - 1;

32
src/mod_fastcgi.c

@ -2893,16 +2893,17 @@ static handler_t fcgi_handle_fdevent(void *s, void *ctx, int revents) {
}
#define PATCH(x) \
p->conf.x = s->x;
static int fcgi_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int fcgi_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(exts);
PATCH(debug);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -2921,17 +2922,6 @@ static int fcgi_patch_connection(server *srv, connection *con, plugin_data *p, c
return 0;
}
static int fcgi_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(exts);
PATCH(debug);
return 0;
}
#undef PATCH
@ -2940,7 +2930,7 @@ static handler_t fcgi_check_extension(server *srv, connection *con, void *p_d, i
size_t s_len;
int used = -1;
int ndx;
size_t k, i;
size_t k;
buffer *fn;
fcgi_extension *extension = NULL;
@ -2955,13 +2945,7 @@ static handler_t fcgi_check_extension(server *srv, connection *con, void *p_d, i
s_len = fn->used - 1;
/* select the right config */
fcgi_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
fcgi_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
fcgi_patch_connection(srv, con, p);
/* check if extension matches */
for (k = 0; k < p->conf.exts->used; k++) {

35
src/mod_mysql_vhost.c

@ -271,16 +271,20 @@ SERVER_FUNC(mod_mysql_vhost_set_defaults) {
#define PATCH(x) \
p->conf.x = s->x;
static int mod_mysql_vhost_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_mysql_vhost_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(mysql_pre);
PATCH(mysql_post);
#ifdef HAVE_MYSQL
PATCH(mysql);
#endif
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -302,19 +306,6 @@ static int mod_mysql_vhost_patch_connection(server *srv, connection *con, plugin
return 0;
}
static int mod_mysql_vhost_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(mysql_pre);
PATCH(mysql_post);
PATCH(mysql);
return 0;
}
#undef PATCH
@ -332,13 +323,7 @@ CONNECTION_FUNC(mod_mysql_vhost_handle_docroot) {
/* no host specified? */
if (!con->uri.authority->used) return HANDLER_GO_ON;
/* apply conditionals */
mod_mysql_vhost_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_mysql_vhost_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_mysql_vhost_patch_connection(srv, con, p);
/* sets up connection data if not done yet */
c = mod_mysql_vhost_connection_data(srv, con, p_d);

42
src/mod_proxy.c

@ -789,16 +789,17 @@ static handler_t proxy_write_request(server *srv, handler_ctx *hctx) {
#define PATCH(x) \
p->conf.x = s->x;
static int mod_proxy_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_proxy_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(extensions);
PATCH(debug);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -819,18 +820,6 @@ static int mod_proxy_patch_connection(server *srv, connection *con, plugin_data
return 0;
}
static int mod_proxy_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(extensions);
PATCH(debug);
PATCH(balance);
return 0;
}
#undef PATCH
SUBREQUEST_FUNC(mod_proxy_handle_subrequest) {
@ -838,17 +827,10 @@ SUBREQUEST_FUNC(mod_proxy_handle_subrequest) {
handler_ctx *hctx = con->plugin_ctx[p->id];
data_proxy *host;
size_t i;
if (NULL == hctx) return HANDLER_GO_ON;
/* select the right config */
mod_proxy_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_proxy_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_proxy_patch_connection(srv, con, p);
host = hctx->host;
@ -1003,7 +985,7 @@ static handler_t mod_proxy_check_extension(server *srv, connection *con, void *p
size_t s_len;
unsigned long last_max = ~0L;
int ndx = -1;
size_t k, i;
size_t k;
buffer *fn;
data_array *extension = NULL;
size_t path_info_offset;
@ -1011,13 +993,7 @@ static handler_t mod_proxy_check_extension(server *srv, connection *con, void *p
/* Possibly, we processed already this request */
if (con->file_started == 1) return HANDLER_GO_ON;
/* select the right config */
mod_proxy_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_proxy_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_proxy_patch_connection(srv, con, p);
fn = con->uri.path;

28
src/mod_redirect.c

@ -134,16 +134,16 @@ SETDEFAULTS_FUNC(mod_redirect_set_defaults) {
return HANDLER_GO_ON;
}
#ifdef HAVE_PCRE_H
static int mod_redirect_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_redirect_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
p->conf.redirect = s->redirect;
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -160,17 +160,6 @@ static int mod_redirect_patch_connection(server *srv, connection *con, plugin_da
return 0;
}
static int mod_redirect_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
p->conf.redirect = s->redirect;
return 0;
}
#endif
static handler_t mod_redirect_uri_handler(server *srv, connection *con, void *p_data) {
#ifdef HAVE_PCRE_H
@ -184,12 +173,7 @@ static handler_t mod_redirect_uri_handler(server *srv, connection *con, void *p_
*
*/
mod_redirect_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_redirect_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_redirect_patch_connection(srv, con, p);
buffer_copy_string_buffer(p->match_buf, con->request.uri);

29
src/mod_rewrite.c

@ -266,16 +266,17 @@ SETDEFAULTS_FUNC(mod_rewrite_set_defaults) {
return HANDLER_GO_ON;
}
#ifdef HAVE_PCRE_H
static int mod_rewrite_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_rewrite_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
p->conf.rewrite = s->rewrite;
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
if (buffer_is_equal_string(dc->comp_key, CONST_STR_LEN("HTTPurl"))) continue;
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -298,17 +299,6 @@ static int mod_rewrite_patch_connection(server *srv, connection *con, plugin_dat
return 0;
}
static int mod_rewrite_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
p->conf.rewrite = s->rewrite;
return 0;
}
#endif
URIHANDLER_FUNC(mod_rewrite_con_reset) {
plugin_data *p = p_d;
@ -348,12 +338,9 @@ URIHANDLER_FUNC(mod_rewrite_uri_handler) {
if (hctx->state == REWRITE_STATE_FINISHED) return HANDLER_GO_ON;
}
mod_rewrite_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_rewrite_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_rewrite_patch_connection(srv, con, p);
if (!p->conf.rewrite) return HANDLER_GO_ON;
buffer_copy_string_buffer(p->match_buf, con->request.uri);

38
src/mod_rrdtool.c

@ -251,16 +251,21 @@ static int mod_rrdtool_create_rrd(server *srv, plugin_data *p, plugin_config *s)
#define PATCH(x) \
p->conf.x = s->x;
static int mod_rrd_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_rrd_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(path_rrdtool_bin);
PATCH(path_rrd);
p->conf.bytes_written_ptr = &(s->bytes_written);
p->conf.bytes_read_ptr = &(s->bytes_read);
p->conf.requests_ptr = &(s->requests);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -282,21 +287,6 @@ static int mod_rrd_patch_connection(server *srv, connection *con, plugin_data *p
return 0;
}
static int mod_rrd_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(path_rrdtool_bin);
PATCH(path_rrd);
p->conf.bytes_written_ptr = &(s->bytes_written);
p->conf.bytes_read_ptr = &(s->bytes_read);
p->conf.requests_ptr = &(s->requests);
return 0;
}
#undef PATCH
SETDEFAULTS_FUNC(mod_rrd_set_defaults) {
@ -431,14 +421,8 @@ TRIGGER_FUNC(mod_rrd_trigger) {
REQUESTDONE_FUNC(mod_rrd_account) {
plugin_data *p = p_d;
size_t i;
mod_rrd_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_rrd_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_rrd_patch_connection(srv, con, p);
*(p->conf.requests_ptr) += 1;
*(p->conf.bytes_written_ptr) += con->bytes_written;

31
src/mod_scgi.c

@ -2592,16 +2592,17 @@ static handler_t scgi_handle_fdevent(void *s, void *ctx, int revents) {
}
#define PATCH(x) \
p->conf.x = s->x;
static int scgi_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int scgi_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(exts);
PATCH(debug);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -2620,17 +2621,6 @@ static int scgi_patch_connection(server *srv, connection *con, plugin_data *p, c
return 0;
}
static int scgi_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(exts);
PATCH(debug);
return 0;
}
#undef PATCH
@ -2639,7 +2629,7 @@ static handler_t scgi_check_extension(server *srv, connection *con, void *p_d, i
size_t s_len;
int used = -1;
int ndx;
size_t k, i;
size_t k;
buffer *fn;
scgi_extension *extension = NULL;
size_t path_info_offset;
@ -2656,12 +2646,7 @@ static handler_t scgi_check_extension(server *srv, connection *con, void *p_d, i
s_len = fn->used - 1;
/* select the right config */
scgi_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
scgi_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
scgi_patch_connection(srv, con, p);
path_info_offset = 0;

33
src/mod_secure_download.c

@ -165,16 +165,19 @@ int is_hex_len(const char *str, size_t len) {
#define PATCH(x) \
p->conf.x = s->x;
static int mod_secdownload_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_secdownload_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(secret);
PATCH(doc_root);
PATCH(uri_prefix);
PATCH(timeout);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -197,19 +200,6 @@ static int mod_secdownload_patch_connection(server *srv, connection *con, plugin
return 0;
}
static int mod_secdownload_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(secret);
PATCH(doc_root);
PATCH(uri_prefix);
PATCH(timeout);
return 0;
}
#undef PATCH
@ -223,12 +213,7 @@ URIHANDLER_FUNC(mod_secdownload_uri_handler) {
if (con->uri.path->used == 0) return HANDLER_GO_ON;
mod_secdownload_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_secdownload_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_secdownload_patch_connection(srv, con, p);
if (buffer_is_empty(p->conf.secret)) {
log_error_write(srv, __FILE__, __LINE__, "s",

31
src/mod_setenv.c

@ -105,16 +105,18 @@ SETDEFAULTS_FUNC(mod_setenv_set_defaults) {
#define PATCH(x) \
p->conf.x = s->x;
static int mod_setenv_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_setenv_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(request_header);
PATCH(response_header);
PATCH(environment);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -135,30 +137,13 @@ static int mod_setenv_patch_connection(server *srv, connection *con, plugin_data
return 0;
}
static int mod_setenv_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(request_header);
PATCH(response_header);
PATCH(environment);
return 0;
}
#undef PATCH
URIHANDLER_FUNC(mod_setenv_uri_handler) {
plugin_data *p = p_d;
size_t k, i;
mod_setenv_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_setenv_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_setenv_patch_connection(srv, con, p);
for (k = 0; k < p->conf.request_header->used; k++) {
data_string *ds = (data_string *)p->conf.request_header->data[k];

40
src/mod_simple_vhost.c

@ -167,16 +167,22 @@ static int build_doc_root(server *srv, connection *con, plugin_data *p, buffer *
#define PATCH(x) \
p->conf.x = s->x;
static int mod_simple_vhost_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_simple_vhost_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(server_root);
PATCH(default_host);
PATCH(document_root);
PATCH(docroot_cache_key);
PATCH(docroot_cache_value);
PATCH(docroot_cache_servername);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -200,27 +206,10 @@ static int mod_simple_vhost_patch_connection(server *srv, connection *con, plugi
return 0;
}
static int mod_simple_vhost_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(server_root);
PATCH(default_host);
PATCH(document_root);
PATCH(docroot_cache_key);
PATCH(docroot_cache_value);
PATCH(docroot_cache_servername);
return 0;
}
#undef PATCH
static handler_t mod_simple_vhost_docroot(server *srv, connection *con, void *p_data) {
plugin_data *p = p_data;
size_t i;
/*
* cache the last successfull translation from hostname (authority) to docroot
@ -228,12 +217,7 @@ static handler_t mod_simple_vhost_docroot(server *srv, connection *con, void *p_
*
*/
mod_simple_vhost_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_simple_vhost_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_simple_vhost_patch_connection(srv, con, p);
if (p->conf.docroot_cache_key->used &&
con->uri.authority->used &&

27
src/mod_skeleton.c

@ -129,16 +129,16 @@ SETDEFAULTS_FUNC(mod_skeleton_set_defaults) {
#define PATCH(x) \
p->conf.x = s->x;
static int mod_skeleton_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_skeleton_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(match);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -155,16 +155,6 @@ static int mod_skeleton_patch_connection(server *srv, connection *con, plugin_da
return 0;
}
static int mod_skeleton_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(match);
return 0;
}
#undef PATCH
URIHANDLER_FUNC(mod_skeleton_uri_handler) {
@ -176,12 +166,7 @@ URIHANDLER_FUNC(mod_skeleton_uri_handler) {
if (con->uri.path->used == 0) return HANDLER_GO_ON;
mod_skeleton_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_skeleton_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_skeleton_patch_connection(srv, con, p);
s_len = con->uri.path->used - 1;

29
src/mod_ssi.c

@ -984,16 +984,16 @@ static int mod_ssi_handle_request(server *srv, connection *con, plugin_data *p)
#define PATCH(x) \
p->conf.x = s->x;
static int mod_ssi_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_ssi_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(ssi_extension);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -1010,30 +1010,15 @@ static int mod_ssi_patch_connection(server *srv, connection *con, plugin_data *p
return 0;
}
static int mod_ssi_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(ssi_extension);
return 0;
}
#undef PATCH
URIHANDLER_FUNC(mod_ssi_physical_path) {
plugin_data *p = p_d;
size_t k, i;
size_t k;
if (con->physical.path->used == 0) return HANDLER_GO_ON;
mod_ssi_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_ssi_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_ssi_patch_connection(srv, con, p);
for (k = 0; k < p->conf.ssi_extension->used; k++) {
data_string *ds = (data_string *)p->conf.ssi_extension->data[k];

39
src/mod_status.c

@ -501,7 +501,12 @@ static handler_t mod_status_handle_server_status_html(server *srv, connection *c
BUFFER_APPEND_STRING_CONST(b, "</td><td class=\"string\">");
buffer_append_string_buffer(b, c->server_name);
if (buffer_is_empty(c->server_name)) {
buffer_append_string_buffer(b, c->uri.authority);
}
else {
buffer_append_string_buffer(b, c->server_name);
}
BUFFER_APPEND_STRING_CONST(b, "</td><td class=\"string\">");
@ -671,16 +676,17 @@ static handler_t mod_status_handle_server_config(server *srv, connection *con, v
#define PATCH(x) \
p->conf.x = s->x;
static int mod_skeleton_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_status_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(status_url);
PATCH(config_url);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -702,29 +708,10 @@ static int mod_skeleton_patch_connection(server *srv, connection *con, plugin_da
return 0;
}
static int mod_skeleton_setup_connection(server *srv, connection *con, plugin_data *p) {
plugin_config *s = p->config_storage[0];
UNUSED(srv);
UNUSED(con);
PATCH(status_url);
PATCH(config_url);
PATCH(sort);
return 0;
}
#undef PATCH
static handler_t mod_status_handler(server *srv, connection *con, void *p_d) {
plugin_data *p = p_d;
size_t i;
mod_skeleton_setup_connection(srv, con, p);
for (i = 0; i < srv->config_patches->used; i++) {
buffer *patch = srv->config_patches->ptr[i];
mod_skeleton_patch_connection(srv, con, p, CONST_BUF_LEN(patch));
}
mod_status_patch_connection(srv, con, p);
if (!buffer_is_empty(p->conf.status_url) &&
buffer_is_equal(p->conf.status_url, con->uri.path)) {

42
src/mod_trigger_b4_dl.c

@ -242,16 +242,22 @@ SETDEFAULTS_FUNC(mod_trigger_b4_dl_set_defaults) {
#define PATCH(x) \
p->conf.x = s->x;
static int mod_trigger_b4_dl_patch_connection(server *srv, connection *con, plugin_data *p, const char *stage, size_t stage_len) {
static int mod_trigger_b4_dl_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
#if defined(HAVE_GDBM) && defined(HAVE_PCRE_H)
PATCH(db);
PATCH(download_regex);
PATCH(trigger_regex);
PATCH(trigger_timeout);
PATCH(deny_url);
#endif
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
plugin_config *s = p->config_storage[i];
/* not our stage */
if (!buffer_is_equal_string(dc->comp_key, stage, stage_len)) continue;
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
@ -288,25 +294,6 @@ static int mod_trigger_b4_dl_patch_connection(server *srv, connection *con, plug
return 0;
}