From: Greg Ames Date: Fri, 21 Jun 2002 13:58:39 +0000 (+0000) Subject: ap_die: get rid of bad side effects from the recursive error handling code X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f9ea34053ac469f0be88c5c92c8502525250f07;p=apache ap_die: get rid of bad side effects from the recursive error handling code that mess with the status and which request_rec the rest of the function uses. Submitted by: Justin Erenkrantz, Greg Ames git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95834 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_request.c b/modules/http/http_request.c index 6177cfde24..543aff226a 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -101,6 +101,7 @@ AP_DECLARE(void) ap_die(int type, request_rec *r) int error_index = ap_index_of_response(type); char *custom_response = ap_response_code_string(r, error_index); int recursive_error = 0; + request_rec *r_1st_err = r; if (type == AP_FILTER_ERROR) { return; @@ -120,10 +121,9 @@ AP_DECLARE(void) ap_die(int type, request_rec *r) if (r->status != HTTP_OK) { recursive_error = type; - while (r->prev && (r->prev->status != HTTP_OK)) - r = r->prev; /* Get back to original error */ + while (r_1st_err->prev && (r_1st_err->prev->status != HTTP_OK)) + r_1st_err = r_1st_err->prev; /* Get back to original error */ - type = r->status; custom_response = NULL; /* Do NOT retry the custom thing! */ } @@ -198,7 +198,7 @@ AP_DECLARE(void) ap_die(int type, request_rec *r) custom_response); } } - ap_send_error_response(r, recursive_error); + ap_send_error_response(r_1st_err, recursive_error); } static void check_pipeline_flush(request_rec *r)