You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ni...@apache.org on 2009/12/27 02:48:49 UTC

svn commit: r894041 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_filter.xml modules/filters/mod_filter.c

Author: niq
Date: Sun Dec 27 01:48:49 2009
New Revision: 894041

URL: http://svn.apache.org/viewvc?rev=894041&view=rev
Log:
mod_filter: enable filters to be configured on non-200 responses
PR 48377

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/mod_filter.xml
    httpd/httpd/trunk/modules/filters/mod_filter.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=894041&r1=894040&r2=894041&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sun Dec 27 01:48:49 2009
@@ -39,6 +39,9 @@
   *) 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,

Modified: httpd/httpd/trunk/docs/manual/mod/mod_filter.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_filter.xml?rev=894041&r1=894040&r2=894041&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_filter.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_filter.xml Sun Dec 27 01:48:49 2009
@@ -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.</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>

Modified: httpd/httpd/trunk/modules/filters/mod_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_filter.c?rev=894041&r1=894040&r2=894041&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_filter.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_filter.c Sun Dec 27 01:48:49 2009
@@ -240,7 +240,8 @@
     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);
     }