From: Justin Erenkrantz Date: Fri, 4 Feb 2005 17:34:25 +0000 (+0000) Subject: mod_proxy: Respect errors reported by pre_connection hooks. X-Git-Tag: 2.0.53~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b3add098f914610fb475f06237e483052403f55;p=thirdparty%2Fapache%2Fhttpd.git mod_proxy: Respect errors reported by pre_connection hooks. MFC: 111304 (adjusted by Justin to apply against 2.0.x proxy) Reviewed by: trawick, jerenkrantz, fielding git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@151375 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index d9fb8bed6bd..cf41935102f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 2.0.53 + *) mod_proxy: Respect errors reported by pre_connection hooks. + [Jeff Trawick] + *) --with-module can now take more than one module to be statically linked: --with-module=:,:,... If the -subdirectory doesn't exist it will be created and diff --git a/modules/proxy/proxy_ftp.c b/modules/proxy/proxy_ftp.c index 245fc015f88..d118a584143 100644 --- a/modules/proxy/proxy_ftp.c +++ b/modules/proxy/proxy_ftp.c @@ -1027,7 +1027,14 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf, */ /* set up the connection filters */ - ap_run_pre_connection(origin, sock); + rc = ap_run_pre_connection(origin, sock); + if (rc != OK && rc != DONE) { + origin->aborted = 1; + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "proxy: FTP: pre_connection setup failed (%d)", + rc); + return rc; + } /* possible results: */ /* 120 Service ready in nnn minutes. */ @@ -1772,7 +1779,14 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf, } /* 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) { + data->aborted = 1; + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "proxy: FTP: pre_connection setup failed (%d)", + rc); + return rc; + } /* * VI: Receive the Response ------------------------ diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index e23e5a29e5e..8d16bd8892d 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -304,6 +304,7 @@ apr_status_t ap_proxy_http_create_connection(apr_pool_t *p, request_rec *r, } } if (new) { + int rc; /* create a new socket */ backend->connection = NULL; @@ -370,7 +371,14 @@ apr_status_t ap_proxy_http_create_connection(apr_pool_t *p, request_rec *r, p_conn->addr, p_conn->name); /* set up the connection filters */ - ap_run_pre_connection(*origin, p_conn->sock); + rc = ap_run_pre_connection(*origin, p_conn->sock); + if (rc != OK && rc != DONE) { + (*origin)->aborted = 1; + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, + "proxy: HTTP: pre_connection setup failed (%d)", + rc); + return rc; + } } return OK; }