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

Revert r1756064 and r1756060 until fixed (tests framework passes).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1756065 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yann Ylavic
2016-08-11 23:37:45 +00:00
parent 25b8c2b589
commit 104ef73c95
8 changed files with 87 additions and 127 deletions

View File

@@ -2699,11 +2699,10 @@ PROXY_DECLARE(apr_status_t) ap_proxy_connect_uds(apr_socket_t *sock,
#endif
}
PROXY_DECLARE(apr_status_t) ap_proxy_check_connection(const char *scheme,
proxy_conn_rec *conn,
server_rec *server,
unsigned max_blank_lines,
int flags)
PROXY_DECLARE(apr_status_t) ap_proxy_check_backend(const char *proxy_function,
proxy_conn_rec *conn,
server_rec *s,
int expect_empty)
{
apr_status_t rv = APR_SUCCESS;
proxy_worker *worker = conn->worker;
@@ -2714,17 +2713,25 @@ PROXY_DECLARE(apr_status_t) ap_proxy_check_connection(const char *scheme,
* e.g. for a timeout or bad status. We should respect this and should
* not continue with a connection via this worker even if we got one.
*/
rv = APR_EINVAL;
rv = APR_NOTFOUND;
}
else if (!conn->sock) {
rv = APR_ENOSOCKET;
rv = APR_ENOTSOCK;
}
else if (conn->connection) {
rv = ap_check_pipeline(conn->connection, conn->tmp_bb,
max_blank_lines);
if (rv == APR_ENOTEMPTY && !(flags & PROXY_CHECK_CONN_EMPTY)) {
conn_rec *c = conn->connection;
rv = ap_get_brigade(c->input_filters, conn->tmp_bb,
AP_MODE_SPECULATIVE, APR_NONBLOCK_READ, 1);
if (APR_STATUS_IS_EAGAIN(rv)) {
rv = APR_SUCCESS;
}
else if (rv == APR_SUCCESS && expect_empty) {
apr_off_t len = 0;
apr_brigade_length(conn->tmp_bb, 0, &len);
if (len) {
rv = APR_ENOTEMPTY;
}
}
apr_brigade_cleanup(conn->tmp_bb);
}
else if (!ap_proxy_is_socket_connected(conn->sock)) {
@@ -2737,7 +2744,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_check_connection(const char *scheme,
* ap_proxy_determine_connection().
*/
char ssl_hostname[PROXY_WORKER_RFC1035_NAME_SIZE];
if (rv == APR_EINVAL
if (rv == APR_NOTFOUND
|| !conn->ssl_hostname
|| PROXY_STRNCPY(ssl_hostname, conn->ssl_hostname)) {
ssl_hostname[0] = '\0';
@@ -2745,13 +2752,14 @@ PROXY_DECLARE(apr_status_t) ap_proxy_check_connection(const char *scheme,
socket_cleanup(conn);
if (rv != APR_ENOTEMPTY) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, APLOGNO(00951)
"%s: backend socket is disconnected.", scheme);
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, server, APLOGNO(03408)
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(03408)
"%s: reusable backend connection is not empty: "
"forcibly closed", scheme);
"forcibly closed", proxy_function);
}
if (ssl_hostname[0]) {
@@ -2777,8 +2785,8 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
proxy_server_conf *conf =
(proxy_server_conf *) ap_get_module_config(sconf, &proxy_module);
rv = ap_proxy_check_connection(proxy_function, conn, s, 0, 0);
if (rv == APR_EINVAL) {
rv = ap_proxy_check_backend(proxy_function, conn, s, 0);
if (rv == APR_NOTFOUND) {
return DECLINED;
}
@@ -2994,7 +3002,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
if (rv == APR_SUCCESS) {
socket_cleanup(conn);
}
rv = APR_EINVAL;
rv = APR_NOTFOUND;
}
return rv == APR_SUCCESS ? OK : DECLINED;