1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-07 04:02:58 +03:00

mod_proxy: Add ap_connection_reusable() for checking if a connection

is reusable as of this point in processing.

mod_proxy_fcgi uses the new API to determine if FCGI_CONN_CLOSE
should be enabled, but that doesn't change existing behavior
since the connection is currently marked for closure elsewhere
in the module.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1526189 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jeff Trawick
2013-09-25 14:29:02 +00:00
parent d6c3186d97
commit d79b9a03c5
5 changed files with 27 additions and 3 deletions

View File

@@ -1,6 +1,9 @@
-*- coding: utf-8 -*- -*- coding: utf-8 -*-
Changes with Apache 2.5.0 Changes with Apache 2.5.0
*) mod_proxy: Add ap_connection_reusable() for checking if a connection
is reusable as of this point in processing. [Jeff Trawick]
*) mod_ssl: drop support for export-grade ciphers with ephemeral RSA *) mod_ssl: drop support for export-grade ciphers with ephemeral RSA
keys, and unconditionally disable aNULL, eNULL and EXP ciphers keys, and unconditionally disable aNULL, eNULL and EXP ciphers
(not overridable via SSLCipherSuite). [Kaspar Brand] (not overridable via SSLCipherSuite). [Kaspar Brand]

View File

@@ -440,6 +440,7 @@
* 20130702.3 (2.5.0-dev) Add util_fcgi.h, FastCGI protocol support * 20130702.3 (2.5.0-dev) Add util_fcgi.h, FastCGI protocol support
* 20130903.0 (2.5.0-dev) Changes sizeof(worker_score) in scoreboard * 20130903.0 (2.5.0-dev) Changes sizeof(worker_score) in scoreboard
* 20130924.0 (2.5.0-dev) Add ap_errorlog_provider * 20130924.0 (2.5.0-dev) Add ap_errorlog_provider
* 20130924.1 (2.5.0-dev) Add ap_proxy_connection_reusable()
*/ */
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */ #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
@@ -447,7 +448,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR #ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20130924 #define MODULE_MAGIC_NUMBER_MAJOR 20130924
#endif #endif
#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */ #define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
/** /**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

View File

@@ -857,6 +857,17 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function, PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
proxy_conn_rec *conn, proxy_conn_rec *conn,
conn_rec *c, server_rec *s); conn_rec *c, server_rec *s);
/**
* Determine if proxy connection can potentially be reused at the
* end of this request.
* @param conn proxy connection
* @return non-zero if reusable, 0 otherwise
* @note Even if this function returns non-zero, the connection may
* be subsequently marked for closure.
*/
PROXY_DECLARE(int) ap_proxy_connection_reusable(proxy_conn_rec *conn);
/** /**
* Signal the upstream chain that the connection to the backend broke in the * Signal the upstream chain that the connection to the backend broke in the
* middle of the response. This is done by sending an error bucket with * middle of the response. This is done by sending an error bucket with

View File

@@ -193,7 +193,9 @@ static apr_status_t send_begin_request(proxy_conn_rec *conn,
ap_fcgi_fill_in_header(&header, AP_FCGI_BEGIN_REQUEST, request_id, ap_fcgi_fill_in_header(&header, AP_FCGI_BEGIN_REQUEST, request_id,
sizeof(abrb), 0); sizeof(abrb), 0);
ap_fcgi_fill_in_request_body(&brb, AP_FCGI_RESPONDER, AP_FCGI_KEEP_CONN); ap_fcgi_fill_in_request_body(&brb, AP_FCGI_RESPONDER,
ap_proxy_connection_reusable(conn)
? AP_FCGI_KEEP_CONN : 0);
ap_fcgi_header_to_array(&header, farray); ap_fcgi_header_to_array(&header, farray);
ap_fcgi_begin_request_body_to_array(&brb, abrb); ap_fcgi_begin_request_body_to_array(&brb, abrb);

View File

@@ -1334,6 +1334,13 @@ static void init_conn_pool(apr_pool_t *p, proxy_worker *worker)
worker->cp = cp; worker->cp = cp;
} }
PROXY_DECLARE(int) ap_proxy_connection_reusable(proxy_conn_rec *conn)
{
proxy_worker *worker = conn->worker;
return ! (conn->close || !worker->s->is_address_reusable || worker->s->disablereuse);
}
static apr_status_t connection_cleanup(void *theconn) static apr_status_t connection_cleanup(void *theconn)
{ {
proxy_conn_rec *conn = (proxy_conn_rec *)theconn; proxy_conn_rec *conn = (proxy_conn_rec *)theconn;
@@ -1362,7 +1369,7 @@ static apr_status_t connection_cleanup(void *theconn)
} }
/* determine if the connection need to be closed */ /* determine if the connection need to be closed */
if (conn->close || !worker->s->is_address_reusable || worker->s->disablereuse) { if (!ap_proxy_connection_reusable(conn)) {
apr_pool_t *p = conn->pool; apr_pool_t *p = conn->pool;
apr_pool_clear(p); apr_pool_clear(p);
conn = apr_pcalloc(p, sizeof(proxy_conn_rec)); conn = apr_pcalloc(p, sizeof(proxy_conn_rec));