https://issues.apache.org/bugzilla/show_bug.cgi?id=56035

--- Comment #9 from Yann Ylavic <[email protected]> ---
For ap_die() /  ap_process[_async]_request() to handle any non-HTTP status
safer, maybe a more complete patch (against trunk) could be :

Index: modules/http/http_request.c
===================================================================
--- modules/http/http_request.c    (revision 1559728)
+++ modules/http/http_request.c    (working copy)
@@ -75,12 +75,17 @@ static void update_r_in_filters(ap_filter_t *f,

 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 error_index;
+    char *custom_response;
     int recursive_error = 0;
     request_rec *r_1st_err = r;

-    if (type == AP_FILTER_ERROR) {
+    if (type == OK || type == DONE) {
+        ap_finalize_request_protocol(r);
+        return;
+    }
+
+    if (!ap_is_HTTP_VALID_RESPONSE(type)) {
         ap_filter_t *next;

         /*
@@ -99,8 +104,14 @@ AP_DECLARE(void) ap_die(int type, request_rec *r)
          * next->frec == ap_http_header_filter
          */
         if (next) {
-            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01579)
-                          "Custom error page caused AP_FILTER_ERROR");
+            if (type == AP_FILTER_ERROR) {
+                ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01579)
+                              "Custom error page caused AP_FILTER_ERROR");
+            }
+            else {
+                ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO()
+                              "Invalid error response status %i", type);
+            }
             type = HTTP_INTERNAL_SERVER_ERROR;
         }
         else {
@@ -108,11 +119,6 @@ AP_DECLARE(void) ap_die(int type, request_rec *r)
         }
     }

-    if (type == DONE) {
-        ap_finalize_request_protocol(r);
-        return;
-    }
-
     /*
      * The following takes care of Apache redirects to custom response URLs
      * Note that if we are already dealing with the response to some other
@@ -141,6 +147,10 @@ AP_DECLARE(void) ap_die(int type, request_rec *r)

         custom_response = NULL; /* Do NOT retry the custom thing! */
     }
+    else {
+        error_index = ap_index_of_response(type);
+        custom_response = ap_response_code_string(r, error_index);
+    }

     r->status = type;

@@ -346,7 +356,9 @@ void ap_process_async_request(request_rec *r)
         ap_finalize_request_protocol(r);
     }
     else {
-        r->status = HTTP_OK;
+        if (ap_is_HTTP_VALID_RESPONSE(access_status)) {
+            r->status = HTTP_OK;
+        }
         ap_die(access_status, r);
     }
[END]

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to