]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backporting the following from Apache 2.1-dev to 2.0.49-dev:
authorPaul J. Reder <rederpj@apache.org>
Wed, 7 Jan 2004 02:49:46 +0000 (02:49 +0000)
committerPaul J. Reder <rederpj@apache.org>
Wed, 7 Jan 2004 02:49:46 +0000 (02:49 +0000)
  *) 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.

Reviewed by: trawick, stoddard

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

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

diff --git a/CHANGES b/CHANGES
index 74b09289c9503633f6bc6b07c532e3e883a3933e..509e3e4262a4fac67d4b245fe7a0f3a583ebb295 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,11 @@
 Changes with Apache 2.0.49
 
+  *) 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]
+
   *) Add Polish translation of error messages.  PR 25101.
      [Tomasz Kepczynski <tomek jot23.org>]
 
diff --git a/STATUS b/STATUS
index f58ecfc8f60545d26a062562ba6132e09c7de6b9..030559138449116c5cb58c95d7cf484f7c9d00b0 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.0 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2004/01/04 15:07:04 $]
+Last modified at [$Date: 2004/01/07 02:49:45 $]
 
 Release:
 
@@ -87,18 +87,7 @@ PATCHES TO BACKPORT FROM 2.1
     * Fix segfault in mod_mem_cache cache_insert() due to cache size
       becoming negative.  PR: 21285, 21287
       http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/experimental/mod_mem_cache.c?r1=1.99&r2=1.100
-      +1: stoddard
-
-    * 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.
-      PR: 19794, 24884, and 25123.
-      http://cvs.apache.org/viewcvs.cgi/httpd-2.0/include/http_protocol.h?r1=1.84&r2=1.85
-      http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/http/http_protocol.c?r1=1.473&r2=1.474
-      http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/metadata/mod_expires.c?r1=1.48&r2=1.49
-        nd: yes, it's a minor bump
-      +1: rederpj, trawick (requires minor MMN bump I believe), stoddard
+      +1: stoddard, rederpj
 
     * Replace some of the mutex locking in the worker MPM with
       atomic operations for higher concurrency.
index 1e45dcadae7a4a3f3b4c5b3c015c594268816178..7d614e5547230c1044bcb2a7cb1079f275647b46 100644 (file)
  * 20020903.3 (2.0.46-dev) allow_encoded_slashes added to core_dir_config
  * 20020903.4 (2.0.47-dev) add ap_is_recursion_limit_exceeded()
  * 20020903.5 (2.0.49-dev) add ap_escape_errorlog_item()
+ * 20020903.6 (2.0.49-dev) add insert_error_filter hook
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20020903
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 5                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 6                     /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index 7683a63e259a2c707741aaa8a88dd5f4711c9e55..9e879122a12b8bd7538aae72f0b76ce889c61c76 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 8ba0d9d99c119984263eddfdfd4dfc9092997140..7be48da8600c8db84d0889494bd4dbc485d4b2f1 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.
@@ -2325,6 +2330,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 47620898db3a14866f456bd872761d92197d17a7..b2d31569bd0f2c24d83e7f9e550ce63dd2569f47 100644 (file)
 #include "http_config.h"
 #include "http_log.h"
 #include "http_request.h"
+#include "http_protocol.h"
 
 typedef struct {
     int active;
@@ -548,6 +549,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);
 }