]> granicus.if.org Git - apache/commitdiff
* Do not overwrite r->status with access_status if access_status is OK or DONE
authorRuediger Pluem <rpluem@apache.org>
Wed, 20 Jul 2016 18:25:01 +0000 (18:25 +0000)
committerRuediger Pluem <rpluem@apache.org>
Wed, 20 Jul 2016 18:25:01 +0000 (18:25 +0000)
  as in this case r->status might contain the true response code.

PR: 59869

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1753592 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/proxy/mod_proxy.c

diff --git a/CHANGES b/CHANGES
index 1c334c9a1aed8c06e3b28f09f1403ce8e10ddea2..5eb74a8961b6bd360a45d4b1a2f5ff8cde0cf414 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mo_proxy: Correctly consider error response codes by the backend when
+     processing failonstatus. PR 59869 [Ruediger Pluem]
+
   *) mod_http2: new H2CopyFiles directive that changes treatment of file
      handles in responses. Necessary in order to fix broken lifetime handling
      in modules such as mod_wsgi.
index b77216e1cf6a11cf94c60cae0101e9173672e51e..166af2795a559b21dbfb1184a679c3a8a426a374 100644 (file)
@@ -1273,16 +1273,24 @@ cleanup:
      * the error page on the proxy or if the error was not generated by the
      * backend itself but by the proxy e.g. a bad gateway) in order to give
      * ap_proxy_post_request a chance to act correctly on the status code.
+     * But only do the above if access_status is not OK and not DONE, because
+     * in this case r->status might contain the true status and overwriting
+     * it with OK or DONE would be wrong.
      */
-    saved_status = r->status;
-    r->status = access_status;
-    ap_proxy_post_request(worker, balancer, r, conf);
-    /*
-     * Only restore r->status if it has not been changed by
-     * ap_proxy_post_request as we assume that this change was intentional.
-     */
-    if (r->status == access_status) {
-        r->status = saved_status;
+    if ((access_status != OK) && (access_status != DONE)) {
+        saved_status = r->status;
+        r->status = access_status;
+        ap_proxy_post_request(worker, balancer, r, conf);
+        /*
+         * Only restore r->status if it has not been changed by
+         * ap_proxy_post_request as we assume that this change was intentional.
+         */
+        if (r->status == access_status) {
+            r->status = saved_status;
+        }
+    }
+    else {
+        ap_proxy_post_request(worker, balancer, r, conf);
     }
 
     proxy_run_request_status(&access_status, r);