]> granicus.if.org Git - apache/commitdiff
*) Add a hook (insert_error_filter) to allow filters to re-insert
authorPaul J. Reder <rederpj@apache.org>
Fri, 12 Dec 2003 17:03:59 +0000 (17:03 +0000)
committerPaul J. Reder <rederpj@apache.org>
Fri, 12 Dec 2003 17:03:59 +0000 (17:03 +0000)
     themselves during processing of error responses. Enable mod_expires
     to use the new hook to include Expires headers in valid error
     responses. This addresses an RFC violation. It fixes PRs 19794,
     24884, and 25123. [Paul J. Reder]

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

CHANGES
include/http_protocol.h
modules/http/http_protocol.c
modules/metadata/mod_expires.c

diff --git a/CHANGES b/CHANGES
index cb3ca0556d08bf5def59f32c957c1f9e58e830f6..3899cd0c73f72ac1cdac66a7854616ce9cb5d191 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,12 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Add a hook (insert_error_filter) to allow filters to re-insert
+     themselves during processing of error responses. Enable mod_expires
+     to use the new hook to include Expires headers in valid error
+     responses. This addresses an RFC violation. It fixes PRs 19794,
+     24884, and 25123. [Paul J. Reder]
+
   *) Fix <Limit> and <LimitExcept> parsing to require a closing '>' 
      in the initial container.  PR 25414. 
      [Geoffrey Young <geoff apache.org>]
index 32c2c64ccfcbca5ff59fcf6eafb4fb8030e4cc0f..1a7c78df05d3c218f0cb3d58b5c58a895a12bb37 100644 (file)
@@ -74,6 +74,13 @@ extern "C" {
  * @package HTTP protocol handling
  */
 
+/**
+ * This hook allows modules to insert filters for the current error response
+ * @param r the current request
+ * @ingroup hooks
+ */
+AP_DECLARE_HOOK(void,insert_error_filter,(request_rec *r))
+
 /* This is an optimization.  We keep a record of the filter_rec that
  * stores the old_write filter, so that we can avoid strcmp's later.
  */
index ce7c60a1955b84fb71e6aa35e62a1c7c66ff3f93..2623d25d4cb256320d374c7d7dd8df8b7ef12fc6 100644 (file)
@@ -182,6 +182,11 @@ static const char * const status_lines[RESPONSE_CODES] =
     "510 Not Extended"
 };
 
+APR_HOOK_STRUCT(
+    APR_HOOK_LINK(insert_error_filter)
+)
+
+AP_IMPLEMENT_HOOK_VOID(insert_error_filter, (request_rec *r), (r))
 
 /* The index of the first bit field that is used to index into a limit
  * bitmask. M_INVALID + 1 to METHOD_NUMBER_LAST.
@@ -2342,6 +2347,8 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error)
 
     r->output_filters = r->proto_output_filters;
 
+    ap_run_insert_error_filter(r);
+
     /*
      * It's possible that the Location field might be in r->err_headers_out
      * instead of r->headers_out; use the latter if possible, else the
index 44a63d56d7f55d1160230ae9e5a344af1d8ff5cc..3025e3318e328d4344092ee6878b092860169406 100644 (file)
 #include "http_config.h"
 #include "http_log.h"
 #include "http_request.h"
+#include "http_protocol.h"
 
 typedef struct {
     int active;
@@ -585,6 +586,7 @@ static void register_hooks(apr_pool_t *p)
 {
     ap_register_output_filter("MOD_EXPIRES", expires_filter, NULL,
                               AP_FTYPE_CONTENT_SET);
+    ap_hook_insert_error_filter(expires_insert_filter, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_insert_filter(expires_insert_filter, NULL, NULL, APR_HOOK_MIDDLE);
 }