Commit 57ffba46 authored by William A. Rowe Jr's avatar William A. Rowe Jr
Browse files

mod_proxy: don't recyle backend announced "Connection: close" connections

to avoid reusing it should the close be effective after some new request
is ready to be sent.

Backports: r1678763, r1703807, r1703813, r1678763
Submitted by: ylavic
Reviewed by: rpluem, wrowe


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1750836 13f79535-47bb-0310-9956-ffa450edef68
parent 88b7bb5e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
                                                         -*- coding: utf-8 -*-
Changes with Apache 2.2.32

  *) mod_proxy: don't recyle backend announced "Connection: close" connections
     to avoid reusing it should the close be effective after some new request
     is ready to be sent.  [Yann Ylavic]

  *) mod_substitute: Allow to configure the patterns merge order with the new
     SubstituteInheritBefore on|off directive.  PR 57641
     [Marc.Stern <Marc.Stern approach.be>, Yann Ylavic, William Rowe]
+0 −11
Original line number Diff line number Diff line
@@ -138,17 +138,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
     2.2.x patch: trunk works, modulo CHANGES
     +1: rjung, wrowe, ylavic

  *) mod_proxy: don't recyle backend announced "Connection: close" connections
     to avoid reusing it should the close be effective after some new request
     is ready to be sent.
     trunk patch: http://svn.apache.org/r1678763
                  http://svn.apache.org/r1703807
                  http://svn.apache.org/r1703813
     2.2.x patch: http://home.apache.org/~ylavic/patches/httpd-2.2.x-mod_proxy-connection_close.patch
     +1: ylavic, rpluem, wrowe
     ylavic: while at it, I also included r1678763 which is only an
             optimization, but allows to keep code in sync with 2.4/trunk.


PATCHES PROPOSED TO BACKPORT FROM TRUNK:
  [ New proposals should be added at the end of the list ]
+16 −9
Original line number Diff line number Diff line
@@ -1399,6 +1399,14 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
}

#if APR_HAS_THREADS
static void socket_cleanup(proxy_conn_rec *conn)
{
    conn->sock = NULL;
    conn->connection = NULL;
    conn->ssl_hostname = NULL;
    apr_pool_clear(conn->scpool);
}

static apr_status_t conn_pool_cleanup(void *theworker)
{
    proxy_worker *worker = (proxy_worker *)theworker;
@@ -1681,7 +1689,8 @@ static apr_status_t connection_cleanup(void *theconn)
#endif

    /* determine if the connection need to be closed */
    if (!ap_proxy_connection_reusable(conn)) {
    if (!worker->is_address_reusable || worker->disablereuse
            || conn->close_on_recycle) {
        apr_pool_t *p = conn->pool;
        apr_pool_clear(p);
        conn = apr_pcalloc(p, sizeof(proxy_conn_rec));
@@ -1690,6 +1699,12 @@ static apr_status_t connection_cleanup(void *theconn)
        apr_pool_create(&(conn->scpool), p);
        apr_pool_tag(conn->scpool, "proxy_conn_scpool");
    }
    else if (conn->close
                || (conn->connection
                    && conn->connection->keepalive == AP_CONN_CLOSE)) {
        socket_cleanup(conn);
        conn->close = 0;
    }
#if APR_HAS_THREADS
    if (worker->hmax && worker->cp->res) {
        conn->inreslist = 1;
@@ -1705,14 +1720,6 @@ static apr_status_t connection_cleanup(void *theconn)
    return APR_SUCCESS;
}

static void socket_cleanup(proxy_conn_rec *conn)
{
    conn->sock = NULL;
    conn->connection = NULL;
    conn->ssl_hostname = NULL;
    apr_pool_clear(conn->scpool);
}

PROXY_DECLARE(apr_status_t) ap_proxy_ssl_connection_cleanup(proxy_conn_rec *conn,
                                                            request_rec *r)
{