Skip to content

Commit 657e8ed

Browse files
committed
* 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 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1753592 13f79535-47bb-0310-9956-ffa450edef68
1 parent a880070 commit 657e8ed

2 files changed

Lines changed: 20 additions & 9 deletions

File tree

CHANGES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
-*- coding: utf-8 -*-
22
Changes with Apache 2.5.0
33

4+
*) mo_proxy: Correctly consider error response codes by the backend when
5+
processing failonstatus. PR 59869 [Ruediger Pluem]
6+
47
*) mod_http2: new H2CopyFiles directive that changes treatment of file
58
handles in responses. Necessary in order to fix broken lifetime handling
69
in modules such as mod_wsgi.

modules/proxy/mod_proxy.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,16 +1273,24 @@ static int proxy_handler(request_rec *r)
12731273
* the error page on the proxy or if the error was not generated by the
12741274
* backend itself but by the proxy e.g. a bad gateway) in order to give
12751275
* ap_proxy_post_request a chance to act correctly on the status code.
1276+
* But only do the above if access_status is not OK and not DONE, because
1277+
* in this case r->status might contain the true status and overwriting
1278+
* it with OK or DONE would be wrong.
12761279
*/
1277-
saved_status = r->status;
1278-
r->status = access_status;
1279-
ap_proxy_post_request(worker, balancer, r, conf);
1280-
/*
1281-
* Only restore r->status if it has not been changed by
1282-
* ap_proxy_post_request as we assume that this change was intentional.
1283-
*/
1284-
if (r->status == access_status) {
1285-
r->status = saved_status;
1280+
if ((access_status != OK) && (access_status != DONE)) {
1281+
saved_status = r->status;
1282+
r->status = access_status;
1283+
ap_proxy_post_request(worker, balancer, r, conf);
1284+
/*
1285+
* Only restore r->status if it has not been changed by
1286+
* ap_proxy_post_request as we assume that this change was intentional.
1287+
*/
1288+
if (r->status == access_status) {
1289+
r->status = saved_status;
1290+
}
1291+
}
1292+
else {
1293+
ap_proxy_post_request(worker, balancer, r, conf);
12861294
}
12871295

12881296
proxy_run_request_status(&access_status, r);

0 commit comments

Comments
 (0)