]> granicus.if.org Git - apache/commitdiff
ap_die: get rid of bad side effects from the recursive error handling code
authorGreg Ames <gregames@apache.org>
Fri, 21 Jun 2002 13:58:39 +0000 (13:58 +0000)
committerGreg Ames <gregames@apache.org>
Fri, 21 Jun 2002 13:58:39 +0000 (13:58 +0000)
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

modules/http/http_request.c

index 6177cfde24deef8daf453110273133ab749bab90..543aff226a204c3037dae2774756497d26df7dda 100644 (file)
@@ -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)