From: Nick Kew Date: Sun, 27 Dec 2009 01:48:49 +0000 (+0000) Subject: mod_filter: enable filters to be configured on non-200 responses X-Git-Tag: 2.3.5~61 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d2adb25b55be2340701bc183a4920ee40335896e;p=thirdparty%2Fapache%2Fhttpd.git mod_filter: enable filters to be configured on non-200 responses PR 48377 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@894041 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 87f11b30b54..c1e486a4210 100644 --- a/CHANGES +++ b/CHANGES @@ -39,6 +39,9 @@ Changes with Apache 2.3.5 *) mod_headers: Enable multi-match-and-replace edit option PR 47066 [Nick Kew] + *) mod_filter: enable it to act on non-200 responses. + PR 48377 [Nick Kew] + Changes with Apache 2.3.4 *) Replace AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex, diff --git a/docs/manual/mod/mod_filter.xml b/docs/manual/mod/mod_filter.xml index 1eed15420d4..dbab59f46b4 100644 --- a/docs/manual/mod/mod_filter.xml +++ b/docs/manual/mod/mod_filter.xml @@ -127,6 +127,13 @@ filters declared, offering the flexibility to insert filters at the beginning or end of the chain, remove a filter, or clear the chain. +
Filtering and Response Status +

mod_filter normally only runs filters on responses with + HTTP status 200 (OK). If you want to filter documents with + other response statuses, you can set the filter-errordocs + environment variable, and it will work on all responses + regardless of status. To refine this further, you can use + expression conditions with FilterProvider.

Upgrading from HTTPD 2.2 Configuration

The FilterProvider diff --git a/modules/filters/mod_filter.c b/modules/filters/mod_filter.c index 6ff1ad43c84..051fa87b101 100644 --- a/modules/filters/mod_filter.c +++ b/modules/filters/mod_filter.c @@ -240,7 +240,8 @@ static apr_status_t filter_harness(ap_filter_t *f, apr_bucket_brigade *bb) harness_ctx *ctx = f->ctx; ap_filter_rec_t *filter = f->frec; - if (f->r->status != 200) { + if (f->r->status != 200 + && !apr_table_get(f->r->subprocess_env, "filter-errordocs")) { ap_remove_output_filter(f); return ap_pass_brigade(f->next, bb); }