|
|
|
@ -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;
|
|
|
|
|
|
|
|
|
|