|
|
008793 |
diff --git a/modules/http/http_request.c b/modules/http/http_request.c
|
|
|
008793 |
index cdfec8b..c97dc77 100644
|
|
|
008793 |
--- a/modules/http/http_request.c
|
|
|
008793 |
+++ b/modules/http/http_request.c
|
|
|
008793 |
@@ -73,19 +73,22 @@ static void update_r_in_filters(ap_filter_t *f,
|
|
|
008793 |
}
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
-AP_DECLARE(void) ap_die(int type, request_rec *r)
|
|
|
008793 |
+static void ap_die_r(int type, request_rec *r, int recursive_error)
|
|
|
008793 |
{
|
|
|
008793 |
- int error_index = ap_index_of_response(type);
|
|
|
008793 |
- char *custom_response = ap_response_code_string(r, error_index);
|
|
|
008793 |
- int recursive_error = 0;
|
|
|
008793 |
+ char *custom_response;
|
|
|
008793 |
request_rec *r_1st_err = r;
|
|
|
008793 |
|
|
|
008793 |
- if (type == AP_FILTER_ERROR) {
|
|
|
008793 |
+ if (type == OK || type == DONE){
|
|
|
008793 |
+ ap_finalize_request_protocol(r);
|
|
|
008793 |
+ return;
|
|
|
008793 |
+ }
|
|
|
008793 |
+
|
|
|
008793 |
+ if (!ap_is_HTTP_VALID_RESPONSE(type)) {
|
|
|
008793 |
ap_filter_t *next;
|
|
|
008793 |
|
|
|
008793 |
/*
|
|
|
008793 |
* Check if we still have the ap_http_header_filter in place. If
|
|
|
008793 |
- * this is the case we should not ignore AP_FILTER_ERROR here because
|
|
|
008793 |
+ * this is the case we should not ignore the error here because
|
|
|
008793 |
* it means that we have not sent any response at all and never
|
|
|
008793 |
* will. This is bad. Sent an internal server error instead.
|
|
|
008793 |
*/
|
|
|
008793 |
@@ -99,8 +102,14 @@ AP_DECLARE(void) ap_die(int type, request_rec *r)
|
|
|
008793 |
* next->frec == ap_http_header_filter
|
|
|
008793 |
*/
|
|
|
008793 |
if (next) {
|
|
|
008793 |
- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01579)
|
|
|
008793 |
- "Custom error page caused AP_FILTER_ERROR");
|
|
|
008793 |
+ if (type != AP_FILTER_ERROR) {
|
|
|
008793 |
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01579)
|
|
|
008793 |
+ "Invalid response status %i", type);
|
|
|
008793 |
+ }
|
|
|
008793 |
+ else {
|
|
|
008793 |
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02831)
|
|
|
008793 |
+ "Response from AP_FILTER_ERROR");
|
|
|
008793 |
+ }
|
|
|
008793 |
type = HTTP_INTERNAL_SERVER_ERROR;
|
|
|
008793 |
}
|
|
|
008793 |
else {
|
|
|
008793 |
@@ -108,20 +117,13 @@ AP_DECLARE(void) ap_die(int type, request_rec *r)
|
|
|
008793 |
}
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
- if (type == DONE) {
|
|
|
008793 |
- ap_finalize_request_protocol(r);
|
|
|
008793 |
- return;
|
|
|
008793 |
- }
|
|
|
008793 |
-
|
|
|
008793 |
/*
|
|
|
008793 |
* The following takes care of Apache redirects to custom response URLs
|
|
|
008793 |
* Note that if we are already dealing with the response to some other
|
|
|
008793 |
* error condition, we just report on the original error, and give up on
|
|
|
008793 |
* any attempt to handle the other thing "intelligently"...
|
|
|
008793 |
*/
|
|
|
008793 |
- if (r->status != HTTP_OK) {
|
|
|
008793 |
- recursive_error = type;
|
|
|
008793 |
-
|
|
|
008793 |
+ if (recursive_error != HTTP_OK) {
|
|
|
008793 |
while (r_1st_err->prev && (r_1st_err->prev->status != HTTP_OK))
|
|
|
008793 |
r_1st_err = r_1st_err->prev; /* Get back to original error */
|
|
|
008793 |
|
|
|
008793 |
@@ -140,6 +142,10 @@ AP_DECLARE(void) ap_die(int type, request_rec *r)
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
custom_response = NULL; /* Do NOT retry the custom thing! */
|
|
|
008793 |
+ } else {
|
|
|
008793 |
+ int error_index = ap_index_of_response(type);
|
|
|
008793 |
+ custom_response = ap_response_code_string(r, error_index);
|
|
|
008793 |
+ recursive_error = 0;
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
r->status = type;
|
|
|
008793 |
@@ -216,6 +222,11 @@ AP_DECLARE(void) ap_die(int type, request_rec *r)
|
|
|
008793 |
ap_send_error_response(r_1st_err, recursive_error);
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
+AP_DECLARE(void) ap_die(int type, request_rec *r)
|
|
|
008793 |
+{
|
|
|
008793 |
+ ap_die_r(type, r, r->status);
|
|
|
008793 |
+}
|
|
|
008793 |
+
|
|
|
008793 |
static void check_pipeline(conn_rec *c)
|
|
|
008793 |
{
|
|
|
008793 |
if (c->keepalive != AP_CONN_CLOSE) {
|
|
|
008793 |
@@ -337,18 +348,7 @@ void ap_process_async_request(request_rec *r)
|
|
|
008793 |
apr_thread_mutex_unlock(r->invoke_mtx);
|
|
|
008793 |
#endif
|
|
|
008793 |
|
|
|
008793 |
- if (access_status == DONE) {
|
|
|
008793 |
- /* e.g., something not in storage like TRACE */
|
|
|
008793 |
- access_status = OK;
|
|
|
008793 |
- }
|
|
|
008793 |
-
|
|
|
008793 |
- if (access_status == OK) {
|
|
|
008793 |
- ap_finalize_request_protocol(r);
|
|
|
008793 |
- }
|
|
|
008793 |
- else {
|
|
|
008793 |
- r->status = HTTP_OK;
|
|
|
008793 |
- ap_die(access_status, r);
|
|
|
008793 |
- }
|
|
|
008793 |
+ ap_die_r(access_status, r, HTTP_OK);
|
|
|
008793 |
|
|
|
008793 |
ap_process_request_after_handler(r);
|
|
|
008793 |
}
|
|
|
008793 |
@@ -631,8 +631,8 @@ AP_DECLARE(void) ap_internal_fast_redirect(request_rec *rr, request_rec *r)
|
|
|
008793 |
|
|
|
008793 |
AP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r)
|
|
|
008793 |
{
|
|
|
008793 |
- request_rec *new = internal_internal_redirect(new_uri, r);
|
|
|
008793 |
int access_status;
|
|
|
008793 |
+ request_rec *new = internal_internal_redirect(new_uri, r);
|
|
|
008793 |
|
|
|
008793 |
AP_INTERNAL_REDIRECT(r->uri, new_uri);
|
|
|
008793 |
|
|
|
008793 |
@@ -648,12 +648,7 @@ AP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r)
|
|
|
008793 |
access_status = ap_invoke_handler(new);
|
|
|
008793 |
}
|
|
|
008793 |
}
|
|
|
008793 |
- if (access_status == OK) {
|
|
|
008793 |
- ap_finalize_request_protocol(new);
|
|
|
008793 |
- }
|
|
|
008793 |
- else {
|
|
|
008793 |
- ap_die(access_status, new);
|
|
|
008793 |
- }
|
|
|
008793 |
+ ap_die(access_status, new);
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
/* This function is designed for things like actions or CGI scripts, when
|
|
|
008793 |
@@ -674,15 +669,9 @@ AP_DECLARE(void) ap_internal_redirect_handler(const char *new_uri, request_rec *
|
|
|
008793 |
ap_set_content_type(new, r->content_type);
|
|
|
008793 |
access_status = ap_process_request_internal(new);
|
|
|
008793 |
if (access_status == OK) {
|
|
|
008793 |
- if ((access_status = ap_invoke_handler(new)) != 0) {
|
|
|
008793 |
- ap_die(access_status, new);
|
|
|
008793 |
- return;
|
|
|
008793 |
- }
|
|
|
008793 |
- ap_finalize_request_protocol(new);
|
|
|
008793 |
- }
|
|
|
008793 |
- else {
|
|
|
008793 |
- ap_die(access_status, new);
|
|
|
008793 |
+ access_status = ap_invoke_handler(new);
|
|
|
008793 |
}
|
|
|
008793 |
+ ap_die(access_status, new);
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
AP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...)
|