From: Jim Jagielski Date: Sat, 5 Sep 2015 17:04:34 +0000 (+0000) Subject: Merge r1597352 from trunk: X-Git-Tag: 2.4.17~154 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65ce7cc44da76e73c73745eb95baf8c0a93438f6;p=apache Merge r1597352 from trunk: * 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 --- diff --git a/STATUS b/STATUS index 930da1f51d..159b176ec3 100644 --- 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: diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index 6a1c3cf523..0f896bdf59 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -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);