]> granicus.if.org Git - apache/commitdiff
Merge r1597352 from trunk:
authorJim Jagielski <jim@apache.org>
Sat, 5 Sep 2015 17:04:34 +0000 (17:04 +0000)
committerJim Jagielski <jim@apache.org>
Sat, 5 Sep 2015 17:04:34 +0000 (17:04 +0000)
* Give ap_proxy_post_request as chance to act correctly on the status code
  by setting r->status temporarily to access_status. r->status might be
  different than access_status e.g. r->status could be HTTP_OK if e.g. we
  override 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.

Submitted by: rpluem
Reviewed/backported by: jim

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

STATUS
modules/proxy/mod_proxy.c

diff --git a/STATUS b/STATUS
index 930da1f51d370101a797d86f812770b59436ddb7..159b176ec39d4f77a433a8b3179f713399cb60ac 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -109,21 +109,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) mod_session_dbd: fix lifetime of Request notes.
-     trunk: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/session/mod_session_dbd.c?r1=1679181&r2=1687087&view=patch
-     2.4.x: trunk patch applies.
-     +1: niq, ylavic, jim
-
-  *) mod_proxy: Give ap_proxy_post_request as chance to act correctly on the status code
-     by setting r->status temporarily to access_status. r->status might be different than
-     access_status e.g. r->status could be HTTP_OK if e.g. we override 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.
-     Trunk version of patch:
-        http://svn.apache.org/r1597352
-     Backport version for 2.4.x of patch:
-        Trunk version of patch works
-     +1: rpluem, ylavic,, jim
 
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
index 6a1c3cf52318e7a988c008afbc1149ca142f7131..0f896bdf598437f1329198d5d7bb4fad3953ebaa 100644 (file)
@@ -934,6 +934,7 @@ static int proxy_handler(request_rec *r)
     proxy_worker *worker = NULL;
     int attempts = 0, max_attempts = 0;
     struct dirconn_entry *list = (struct dirconn_entry *)conf->dirconn->elts;
+    int saved_status;
 
     /* is this for us? */
     if (!r->filename) {
@@ -1206,7 +1207,23 @@ static int proxy_handler(request_rec *r)
         goto cleanup;
     }
 cleanup:
+    /*
+     * Save current r->status and set it to the value of access_status which
+     * might be different (e.g. r->status could be HTTP_OK if e.g. we override
+     * 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.
+     */
+    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;
+    }
 
     proxy_run_request_status(&access_status, r);
     AP_PROXY_RUN_FINISHED(r, attempts, access_status);