You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2014/05/24 22:55:53 UTC
svn commit: r1597352 - /httpd/httpd/trunk/modules/proxy/mod_proxy.c
Author: rpluem
Date: Sat May 24 20:55:52 2014
New Revision: 1597352
URL: http://svn.apache.org/r1597352
Log:
* 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.
Modified:
httpd/httpd/trunk/modules/proxy/mod_proxy.c
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=1597352&r1=1597351&r2=1597352&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Sat May 24 20:55:52 2014
@@ -925,6 +925,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) {
@@ -1200,7 +1201,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);