altarch-user / rpms / httpd

Forked from rpms/httpd 2 years ago
Clone

Blame SOURCES/httpd-2.4.6-r1526189.patch

4126fd
diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h
4126fd
index 81fd14c..cd1710f 100644
4126fd
--- a/modules/proxy/mod_proxy.h
4126fd
+++ b/modules/proxy/mod_proxy.h
4126fd
@@ -856,6 +856,17 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
4126fd
 PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
4126fd
                                               proxy_conn_rec *conn,
4126fd
                                               conn_rec *c, server_rec *s);
4126fd
+
4126fd
+/**
4126fd
+ * Determine if proxy connection can potentially be reused at the
4126fd
+ * end of this request.
4126fd
+ * @param conn proxy connection
4126fd
+ * @return non-zero if reusable, 0 otherwise
4126fd
+ * @note Even if this function returns non-zero, the connection may
4126fd
+ * be subsequently marked for closure.
4126fd
+ */
4126fd
+PROXY_DECLARE(int) ap_proxy_connection_reusable(proxy_conn_rec *conn);
4126fd
+
4126fd
 /**
4126fd
  * Signal the upstream chain that the connection to the backend broke in the
4126fd
  * middle of the response. This is done by sending an error bucket with
4126fd
diff --git a/modules/proxy/mod_proxy_fcgi.c b/modules/proxy/mod_proxy_fcgi.c
4126fd
index 0f84416..c57696a 100644
4126fd
--- a/modules/proxy/mod_proxy_fcgi.c
4126fd
+++ b/modules/proxy/mod_proxy_fcgi.c
4126fd
@@ -247,7 +247,7 @@ static apr_status_t send_begin_request(proxy_conn_rec *conn, int request_id)
4126fd
 
4126fd
     brb.roleB1 = ((FCGI_RESPONDER >> 8) & 0xff);
4126fd
     brb.roleB0 = ((FCGI_RESPONDER) & 0xff);
4126fd
-    brb.flags = FCGI_KEEP_CONN;
4126fd
+    brb.flags = ap_proxy_connection_reusable(conn) ? FCGI_KEEP_CONN : 0;
4126fd
     brb.reserved[0] = 0;
4126fd
     brb.reserved[1] = 0;
4126fd
     brb.reserved[2] = 0;
4126fd
diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c
4126fd
index 8bc9fab..ca70ae4 100644
4126fd
--- a/modules/proxy/proxy_util.c
4126fd
+++ b/modules/proxy/proxy_util.c
4126fd
@@ -1333,6 +1333,13 @@ static void init_conn_pool(apr_pool_t *p, proxy_worker *worker)
4126fd
     worker->cp = cp;
4126fd
 }
4126fd
 
4126fd
+PROXY_DECLARE(int) ap_proxy_connection_reusable(proxy_conn_rec *conn)
4126fd
+{
4126fd
+    proxy_worker *worker = conn->worker;
4126fd
+
4126fd
+    return ! (conn->close || !worker->s->is_address_reusable || worker->s->disablereuse);
4126fd
+}
4126fd
+
4126fd
 static apr_status_t connection_cleanup(void *theconn)
4126fd
 {
4126fd
     proxy_conn_rec *conn = (proxy_conn_rec *)theconn;
4126fd
@@ -1361,7 +1368,7 @@ static apr_status_t connection_cleanup(void *theconn)
4126fd
     }
4126fd
 
4126fd
     /* determine if the connection need to be closed */
4126fd
-    if (conn->close || !worker->s->is_address_reusable || worker->s->disablereuse) {
4126fd
+    if (!ap_proxy_connection_reusable(conn)) {
4126fd
         apr_pool_t *p = conn->pool;
4126fd
         apr_pool_clear(p);
4126fd
         conn = apr_pcalloc(p, sizeof(proxy_conn_rec));