Backport trunk changes for changeset:1072 and changeset:1073 to 2.5, but leave out the error filter code until more testing is completed. See #498.

This commit is contained in:
brectanus
2008-06-05 16:55:53 +00:00
parent f417680065
commit e1342ff011
6 changed files with 28 additions and 16 deletions

View File

@@ -919,7 +919,8 @@ static void hook_insert_filter(request_rec *r) {
/* Add the input filter, but only if we need it to run. */
if (msr->if_status == IF_STATUS_WANTS_TO_RUN) {
if (msr->txcfg->debuglog_level >= 4) {
msr_log(msr, 4, "Hook insert_filter: Adding input forwarding filter %s(r %pp).", (((r->main != NULL)||(r->prev != NULL)) ? "for subrequest " : ""), r);
msr_log(msr, 4, "Hook insert_filter: Adding input forwarding filter %s(r %pp).",
(((r->main != NULL)||(r->prev != NULL)) ? "for subrequest " : ""), r);
}
ap_add_input_filter("MODSECURITY_IN", msr, r, r->connection);
@@ -961,7 +962,8 @@ static void hook_insert_filter(request_rec *r) {
}
}
/* NOTE: This is causing and endless loop when blocking in phase:3 */
// TODO: Holding off on this for now (needs more testing)
#if 0
/**
* Invoked whenever Apache starts processing an error. A chance
* to insert ourselves into the output filter chain.
@@ -975,16 +977,6 @@ static void hook_insert_error_filter(request_rec *r) {
msr = retrieve_tx_context(r);
if (msr == NULL) return;
/* Do not run if we are already running, which may happen
* if we intercept in phase 3.
*/
if (msr->of_is_error == 1) {
if (msr->txcfg->debuglog_level >= 4) {
msr_log(msr, 4, "Hook insert_error_filter: Already processing.");
}
return;
}
/* Do not run if not enabled. */
if (msr->txcfg->is_enabled == 0) {
if (msr->txcfg->debuglog_level >= 4) {
@@ -1013,6 +1005,7 @@ static void hook_insert_error_filter(request_rec *r) {
}
}
}
#endif
#if (!defined(NO_MODSEC_API))
/**
@@ -1113,7 +1106,9 @@ static void register_hooks(apr_pool_t *mp) {
/* Filter hooks */
ap_hook_insert_filter(hook_insert_filter, NULL, NULL, APR_HOOK_FIRST);
#if 0
ap_hook_insert_error_filter(hook_insert_error_filter, NULL, NULL, APR_HOOK_FIRST);
#endif
ap_register_input_filter("MODSECURITY_IN", input_filter,
NULL, AP_FTYPE_CONTENT_SET);