Skip to content

Commit 204c4c2

Browse files
author
Paul J. Reder
committed
Backporting the following from Apache 2.1-dev to 2.0.49-dev: *) 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
1 parent b2f9b14 commit 204c4c2

6 files changed

Lines changed: 26 additions & 14 deletions

File tree

CHANGES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
Changes with Apache 2.0.49
22

3+
*) Add a hook (insert_error_filter) to allow filters to re-insert
4+
themselves during processing of error responses. Enable mod_expires
5+
to use the new hook to include Expires headers in valid error
6+
responses. This addresses an RFC violation. It fixes PRs 19794,
7+
24884, and 25123. [Paul J. Reder]
8+
39
*) Add Polish translation of error messages. PR 25101.
410
[Tomasz Kepczynski <tomek jot23.org>]
511

STATUS

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
APACHE 2.0 STATUS: -*-text-*-
2-
Last modified at [$Date: 2004/01/04 15:07:04 $]
2+
Last modified at [$Date: 2004/01/07 02:49:45 $]
33

44
Release:
55

@@ -87,18 +87,7 @@ PATCHES TO BACKPORT FROM 2.1
8787
* Fix segfault in mod_mem_cache cache_insert() due to cache size
8888
becoming negative. PR: 21285, 21287
8989
http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/experimental/mod_mem_cache.c?r1=1.99&r2=1.100
90-
+1: stoddard
91-
92-
* Add a hook (insert_error_filter) to allow filters to re-insert
93-
themselves during processing of error responses. Enable mod_expires
94-
to use the new hook to include Expires headers in valid error
95-
responses. This addresses an RFC violation.
96-
PR: 19794, 24884, and 25123.
97-
http://cvs.apache.org/viewcvs.cgi/httpd-2.0/include/http_protocol.h?r1=1.84&r2=1.85
98-
http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/http/http_protocol.c?r1=1.473&r2=1.474
99-
http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/metadata/mod_expires.c?r1=1.48&r2=1.49
100-
nd: yes, it's a minor bump
101-
+1: rederpj, trawick (requires minor MMN bump I believe), stoddard
90+
+1: stoddard, rederpj
10291

10392
* Replace some of the mutex locking in the worker MPM with
10493
atomic operations for higher concurrency.

include/ap_mmn.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,15 @@
115115
* 20020903.3 (2.0.46-dev) allow_encoded_slashes added to core_dir_config
116116
* 20020903.4 (2.0.47-dev) add ap_is_recursion_limit_exceeded()
117117
* 20020903.5 (2.0.49-dev) add ap_escape_errorlog_item()
118+
* 20020903.6 (2.0.49-dev) add insert_error_filter hook
118119
*/
119120

120121
#define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
121122

122123
#ifndef MODULE_MAGIC_NUMBER_MAJOR
123124
#define MODULE_MAGIC_NUMBER_MAJOR 20020903
124125
#endif
125-
#define MODULE_MAGIC_NUMBER_MINOR 5 /* 0...n */
126+
#define MODULE_MAGIC_NUMBER_MINOR 6 /* 0...n */
126127

127128
/**
128129
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a

include/http_protocol.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ extern "C" {
7474
* @package HTTP protocol handling
7575
*/
7676

77+
/**
78+
* This hook allows modules to insert filters for the current error response
79+
* @param r the current request
80+
* @ingroup hooks
81+
*/
82+
AP_DECLARE_HOOK(void,insert_error_filter,(request_rec *r))
83+
7784
/* This is an optimization. We keep a record of the filter_rec that
7885
* stores the old_write filter, so that we can avoid strcmp's later.
7986
*/

modules/http/http_protocol.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ static const char * const status_lines[RESPONSE_CODES] =
182182
"510 Not Extended"
183183
};
184184

185+
APR_HOOK_STRUCT(
186+
APR_HOOK_LINK(insert_error_filter)
187+
)
188+
189+
AP_IMPLEMENT_HOOK_VOID(insert_error_filter, (request_rec *r), (r))
185190

186191
/* The index of the first bit field that is used to index into a limit
187192
* 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)
23252330

23262331
r->output_filters = r->proto_output_filters;
23272332

2333+
ap_run_insert_error_filter(r);
2334+
23282335
/*
23292336
* It's possible that the Location field might be in r->err_headers_out
23302337
* instead of r->headers_out; use the latter if possible, else the

modules/metadata/mod_expires.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@
205205
#include "http_config.h"
206206
#include "http_log.h"
207207
#include "http_request.h"
208+
#include "http_protocol.h"
208209

209210
typedef struct {
210211
int active;
@@ -548,6 +549,7 @@ static void register_hooks(apr_pool_t *p)
548549
{
549550
ap_register_output_filter("MOD_EXPIRES", expires_filter, NULL,
550551
AP_FTYPE_CONTENT_SET);
552+
ap_hook_insert_error_filter(expires_insert_filter, NULL, NULL, APR_HOOK_MIDDLE);
551553
ap_hook_insert_filter(expires_insert_filter, NULL, NULL, APR_HOOK_MIDDLE);
552554
}
553555

0 commit comments

Comments
 (0)