Commit 760a8e8b authored by Jim Jagielski's avatar Jim Jagielski
Browse files

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
parent 7f04f817
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -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:
+17 −0
Original line number Diff line number Diff line
@@ -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);