r1750836 broke the httpd 2.2 build if APR_HAS_THREADS is not defined.
I suppose this won't be fixed because 2.2 is EOL.
I just wanted to mention it in case somebody cares.
modules/proxy/proxy_util.c:1705: undefined reference to `socket_cleanup'
modules/proxy/.libs/libmod_proxy.a(proxy_util.o): In function
`ap_proxy_ssl_connection_cleanup':
modules/proxy/proxy_util.c:1743: undefined reference to `socket_cleanup'
modules/proxy/.libs/libmod_proxy.a(proxy_util.o): In function
`ap_proxy_determine_connection':
modules/proxy/proxy_util.c:2235: undefined reference to `socket_cleanup'
modules/proxy/proxy_util.c:2281: undefined reference to `socket_cleanup'
modules/proxy/proxy_util.c:2337: undefined reference to `socket_cleanup'
modules/proxy/.libs/libmod_proxy.a(proxy_util.o):modules/proxy/proxy_util.c:2542:
more undefined references to `socket_cleanup' follow
------------------------------------------------------------------------
r1750836 | wrowe | 2016-06-30 19:07:29 +0200 (Thu, 30 Jun 2016) | 8 lines
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
Index: httpd/httpd/branches/2.2.x/STATUS
===================================================================
--- httpd/httpd/branches/2.2.x/STATUS (revision 1750835)
+++ httpd/httpd/branches/2.2.x/STATUS (revision 1750836)
@@ -138,18 +138,7 @@ 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 ]
Index: httpd/httpd/branches/2.2.x/CHANGES
===================================================================
--- httpd/httpd/branches/2.2.x/CHANGES (revision 1750835)
+++ httpd/httpd/branches/2.2.x/CHANGES (revision 1750836)
@@ -1,6 +1,10 @@
-*- 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]
Index: httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c
===================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c (revision
1750835)
+++ httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c (revision
1750836)
@@ -1399,6 +1399,14 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(
}
#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 *theco
#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 *theco
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 *theco
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)
{
------------------------------------------------------------------------