From: Yann Ylavic Date: Mon, 27 Jun 2016 16:06:42 +0000 (+0000) Subject: mod_proxy: revert r1750301, r1750305 and r1750311. X-Git-Tag: 2.5.0-alpha~1466 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ddbed1bafbe10aceb1206dc129c1552a838278f;p=apache mod_proxy: revert r1750301, r1750305 and r1750311. Rework needed. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1750376 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 07a9feb6fd..229e85f651 100644 --- a/CHANGES +++ b/CHANGES @@ -1,9 +1,6 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 - *) mod_proxy: don't reuse backend connections with data available before the - request is sent. PR 57832. [Yann Ylavic] - *) mod_sed: Fix 'x' command processing. [Christophe Jaillet] *) core: Drop an invalid Last-Modified header value coming diff --git a/docs/log-message-tags/next-number b/docs/log-message-tags/next-number index 46cff15d5b..1487908673 100644 --- a/docs/log-message-tags/next-number +++ b/docs/log-message-tags/next-number @@ -1 +1 @@ -3409 +3408 diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 230bdebf25..c4c4188b01 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -532,7 +532,6 @@ * dav_success_proppatch. * 20160608.4 (2.5.0-dev) Add dav_acl_provider, dav_acl_provider_register * dav_get_acl_providers. - * 20160608.5 (2.5.0-dev) Add tmp_bb to proxy_conn_rec. */ #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */ @@ -540,7 +539,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20160608 #endif -#define MODULE_MAGIC_NUMBER_MINOR 5 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 4 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index 268ebc37d5..467984dfa8 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -271,7 +271,6 @@ typedef struct { unsigned int inreslist:1; /* connection in apr_reslist? */ const char *uds_path; /* Unix domain socket path */ const char *ssl_hostname;/* Hostname (SNI) in use by SSL connection */ - apr_bucket_brigade *tmp_bb; } proxy_conn_rec; typedef struct { diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 6f8849d530..6fee211e5b 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -2487,7 +2487,7 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r, #endif #if USE_ALTERNATE_IS_CONNECTED && defined(APR_MSG_PEEK) -static int get_socket_connected(apr_socket_t *socket) +PROXY_DECLARE(int) ap_proxy_is_socket_connected(apr_socket_t *socket) { apr_pollfd_t pfds[1]; apr_status_t status; @@ -2514,7 +2514,7 @@ static int get_socket_connected(apr_socket_t *socket) status = apr_socket_recvfrom(&unused, socket, APR_MSG_PEEK, &buf[0], &len); if (status == APR_SUCCESS && len) - return 2; + return 1; else return 0; } @@ -2525,7 +2525,8 @@ static int get_socket_connected(apr_socket_t *socket) } #else -static int get_socket_connnected(apr_socket_t *socket) +PROXY_DECLARE(int) ap_proxy_is_socket_connected(apr_socket_t *socket) + { apr_size_t buffer_len = 1; char test_buffer[1]; @@ -2543,19 +2544,12 @@ static int get_socket_connnected(apr_socket_t *socket) || APR_STATUS_IS_ECONNRESET(socket_status)) { return 0; } - else if (status == APR_SUCCESS && buffer_len) { - return 2; - } else { return 1; } } #endif /* USE_ALTERNATE_IS_CONNECTED */ -PROXY_DECLARE(int) ap_proxy_is_socket_connected(apr_socket_t *socket) -{ - return get_socket_connected(socket) != 0; -} /* * Send a HTTP CONNECT request to a forward proxy. @@ -2722,35 +2716,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function, (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); if (conn->sock) { - conn_rec *c = conn->connection; - if (!c) { - connected = get_socket_connected(conn->sock); - } - else { - if (conn->tmp_bb == NULL) { - conn->tmp_bb = apr_brigade_create(c->pool, c->bucket_alloc); - } - rv = ap_get_brigade(c->input_filters, conn->tmp_bb, - AP_MODE_SPECULATIVE, APR_NONBLOCK_READ, 1); - if (rv == APR_SUCCESS) { - apr_off_t len = 0; - apr_brigade_length(conn->tmp_bb, 0, &len); - if (len) { - connected = 2; - } - else { - connected = 1; - } - } - else if (APR_STATUS_IS_EAGAIN(rv)) { - connected = 1; - } - else { - connected = 0; - } - apr_brigade_cleanup(conn->tmp_bb); - } - if (connected != 1) { + if (!(connected = ap_proxy_is_socket_connected(conn->sock))) { /* This clears conn->scpool (and associated data), so backup and * restore any ssl_hostname for this connection set earlier by * ap_proxy_determine_connection(). @@ -2762,17 +2728,9 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function, } socket_cleanup(conn); - if (!connected) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00951) - "%s: backend socket is disconnected.", - proxy_function); - } - else { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(03408) - "%s: reusable backend connection is not empty: " - "forcibly closed", proxy_function); - connected = 0; - } + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00951) + "%s: backend socket is disconnected.", + proxy_function); if (ssl_hostname[0]) { conn->ssl_hostname = apr_pstrdup(conn->scpool, ssl_hostname);