]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1753592 from trunk:
authorYann Ylavic <ylavic@apache.org>
Sat, 7 Jan 2017 12:51:25 +0000 (12:51 +0000)
committerYann Ylavic <ylavic@apache.org>
Sat, 7 Jan 2017 12:51:25 +0000 (12:51 +0000)
* Do not overwrite r->status with access_status if access_status is OK or DONE
  as in this case r->status might contain the true response code.

PR: 59869

Submitted by: rpluem
Reviewed/backported by: ylavic, wrowe, covener, orlikowski

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1777775 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/proxy/mod_proxy.c

diff --git a/CHANGES b/CHANGES
index 0516b34c13859fdbd434e32879487c1f31b8d833..b719a25239cd1de7413419c297c940bba1478485 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -48,6 +48,9 @@ Changes with Apache 2.2.32
   *) Core: reject NULLs in request line or request headers.
      PR 43039 [Nick Kew]
 
+  *) mod_proxy: Correctly consider error response codes by the backend when
+     processing failonstatus. PR 59869 [Ruediger Pluem]
+
   *) mod_ssl: Fix a possible memory leak on restart for custom [EC]DH params.
      [Jan Kaluza, Yann Ylavic]
 
index 4e91e656ed69e9670d1a1e1fb4b31d70ae729273..f21891ba0a156645d49f5bd4b190c89e51b1c03d 100644 (file)
@@ -1087,20 +1087,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;
-        int post_status = proxy_run_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;
+            proxy_run_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 (post_status == DECLINED) {
-            post_status = OK; /* no post_request handler available */
-            /* TODO: recycle direct worker */
+        else {
+            ap_proxy_post_request(worker, balancer, r, conf);
         }
     }