/* Search thru the input filters and remove the reqtimeout one */ static void remove_reqtimeout(ap_filter_t *next) { ap_filter_t *reqto = NULL; ap_filter_rec_t *filter; filter = ap_get_input_filter_handle("reqtimeout"); if (!filter) { return; } while (next) { if (next->frec == filter) { reqto = next; break; } next = next->next; } if (reqto) { ap_remove_input_filter(reqto); } }
static int modperl_filter_add_connection(conn_rec *c, int idx, const char *name, modperl_filter_add_t addfunc, const char *type) { modperl_config_dir_t *dcfg = modperl_config_dir_get_defaults(c->base_server); MpAV *av; if ((av = dcfg->handlers_per_dir[idx])) { modperl_handler_t **handlers = (modperl_handler_t **)av->elts; int i; for (i=0; i<av->nelts; i++) { modperl_filter_ctx_t *ctx; ap_filter_t *f; /* process non-mod_perl filter handlers */ if ((handlers[i]->attrs & MP_FILTER_HTTPD_HANDLER)) { /* non-mp2 filters below PROTOCOL level can't be added * at the connection level, so we need to go through * the pain of figuring out the type of the filter */ ap_filter_rec_t *frec; char *normalized_name = apr_pstrdup(c->pool, handlers[i]->name); ap_str_tolower(normalized_name); frec = idx == MP_INPUT_FILTER_HANDLER ? ap_get_input_filter_handle(normalized_name) : ap_get_output_filter_handle(normalized_name); if (frec && frec->ftype < AP_FTYPE_PROTOCOL) { MP_TRACE_f(MP_FUNC, "a non-mod_perl %s handler %s " "skipped (not a connection filter)", type, handlers[i]->name); continue; } addfunc(handlers[i]->name, NULL, NULL, c); MP_TRACE_f(MP_FUNC, "a non-mod_perl %s handler %s configured " "(connection)", type, handlers[i]->name); continue; } /* skip non-connection level filters, e.g. request filters * configured outside the resource container */ if (!(handlers[i]->attrs & MP_FILTER_CONNECTION_HANDLER)) { MP_TRACE_f(MP_FUNC, "%s is not a FilterConnection handler, skipping", handlers[i]->name); continue; } ctx = (modperl_filter_ctx_t *)apr_pcalloc(c->pool, sizeof(*ctx)); ctx->handler = handlers[i]; f = addfunc(name, (void*)ctx, NULL, c); /* ap_filter_t filter cleanup */ apr_pool_cleanup_register(c->pool, (void *)f, modperl_filter_f_cleanup, apr_pool_cleanup_null); if (handlers[i]->attrs & MP_FILTER_HAS_INIT_HANDLER && handlers[i]->next) { int status = modperl_run_filter_init( f, (idx == MP_INPUT_FILTER_HANDLER ? MP_INPUT_FILTER_MODE : MP_OUTPUT_FILTER_MODE), handlers[i]->next); if (status != OK) { return status; } } MP_TRACE_h(MP_FUNC, "%s handler %s configured (connection)", type, handlers[i]->name); } return OK; } MP_TRACE_h(MP_FUNC, "no %s handlers configured (connection)", type); return DECLINED; }