From: Jeff Trawick Date: Wed, 8 Dec 2004 20:19:04 +0000 (+0000) Subject: mod_proxy: Respect errors reported by pre_connection hooks. X-Git-Tag: 2.1.2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=803d2b468dbf8006217184b495482a13deb085d1;p=thirdparty%2Fapache%2Fhttpd.git mod_proxy: Respect errors reported by pre_connection hooks. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@111304 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 2c7990d28c5..ab1077cfb65 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.1.2-dev [Remove entries to the current 2.0 section below, when backported] + *) mod_proxy: Respect errors reported by pre_connection hooks. + [Jeff Trawick] + *) worker MPM: Fix a problem which could cause httpd processes to remain active after shutdown. [Jeff Trawick] diff --git a/modules/proxy/proxy_ftp.c b/modules/proxy/proxy_ftp.c index 113593ed80d..b0e9b41dc06 100644 --- a/modules/proxy/proxy_ftp.c +++ b/modules/proxy/proxy_ftp.c @@ -1725,7 +1725,15 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker, } /* set up the connection filters */ - ap_run_pre_connection(data, data_sock); + rc = ap_run_pre_connection(data, data_sock); + if (rc != OK && rc != DONE) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "proxy: FTP: pre_connection setup failed (%d)", + rc); + data->aborted = 1; + proxy_ftp_cleanup(r, backend); + return rc; + } /* * VI: Receive the Response ------------------------ diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 0bf1430d7bc..331ba1619e5 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -1819,6 +1819,7 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function, server_rec *s) { apr_sockaddr_t *backend_addr = conn->addr; + int rc; /* The socket is now open, create a new backend server connection * @@ -1867,7 +1868,14 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function, proxy_function, backend_addr, conn->hostname); /* set up the connection filters */ - ap_run_pre_connection(conn->connection, conn->sock); + rc = ap_run_pre_connection(conn->connection, conn->sock); + if (rc != OK && rc != DONE) { + conn->connection->aborted = 1; + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "proxy: %s: pre_connection setup failed (%d)", + proxy_function, rc); + return rc; + } return OK; }