mod_filter: enable filters to be configured on non-200 responses
authorNick Kew <niq@apache.org>
Sun, 27 Dec 2009 01:48:49 +0000 (01:48 +0000)
committerNick Kew <niq@apache.org>
Sun, 27 Dec 2009 01:48:49 +0000 (01:48 +0000)
PR 48377

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@894041 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_filter.xml
modules/filters/mod_filter.c

diff --git a/CHANGES b/CHANGES
index 87f11b30b5474292b0235d9a507280d5b46e1f42..c1e486a4210f3984ef011a44cc5c66b9876f2830 100644 (file)
--- 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,
index 1eed15420d4dd26ffa12d5164fb5bdb656f1f065..dbab59f46b4864ee1bdb3cb26809a7e9bfabe983 100644 (file)
     filters declared, offering the flexibility to insert filters at the
     beginning or end of the chain, remove a filter, or clear the chain.</dd>
 </dl>
+<section id="errordocs"><title>Filtering and Response Status</title>
+    <p>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 <var>filter-errordocs</var>
+    environment variable, and it will work on all responses
+    regardless of status.  To refine this further, you can use
+    expression conditions with <directive>FilterProvider</directive>.</p>
 </section>
 <section id="upgrade"><title>Upgrading from HTTPD 2.2 Configuration</title>
     <p>The <directive module="mod_filter">FilterProvider</directive>
index 6ff1ad43c84c7042ccff143cb4acba15a6437b3b..051fa87b1012f831fbf9e590a4a53b9b3072180a 100644 (file)
@@ -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);
     }