altarch-user / rpms / httpd

Forked from rpms/httpd 2 years ago
Clone

Blame SOURCES/httpd-2.4.6-r1526189.patch

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