From: Victor J. Orlikowski Date: Fri, 3 Aug 2001 18:00:38 +0000 (+0000) Subject: Add a timeout when making connections from within the proxy. X-Git-Tag: 2.0.23~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=82290d054d8b4faaf526323885d439f51ad7f705;p=apache Add a timeout when making connections from within the proxy. Now, if someone wants to add a special scoreboard state for proxy attempting to make connection, be my guest. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89908 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/proxy_connect.c b/modules/proxy/proxy_connect.c index e238c66fdc..c63c33ff30 100644 --- a/modules/proxy/proxy_connect.c +++ b/modules/proxy/proxy_connect.c @@ -222,6 +222,9 @@ int ap_proxy_connect_handler(request_rec *r, proxy_server_conf *conf, return HTTP_INTERNAL_SERVER_ERROR; } + /* Set a timeout on the socket */ + apr_setsocketopt(sock, APR_SO_TIMEOUT, (int)(r->server->timeout * APR_USEC_PER_SEC)); + /* * At this point we have a list of one or more IP addresses of * the machine to connect to. If configured, reorder this diff --git a/modules/proxy/proxy_ftp.c b/modules/proxy/proxy_ftp.c index 2605b95d10..ec39ce1a4a 100644 --- a/modules/proxy/proxy_ftp.c +++ b/modules/proxy/proxy_ftp.c @@ -696,6 +696,9 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf, #endif /*_OSD_POSIX*/ } + /* Set a timeout on the socket */ + apr_setsocketopt(sock, APR_SO_TIMEOUT, (int)(r->server->timeout * APR_USEC_PER_SEC)); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, "proxy: FTP: socket has been created"); diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index fd2edfa770..184c8c7844 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -377,6 +377,9 @@ int ap_proxy_http_handler(request_rec *r, proxy_server_conf *conf, } #endif + /* Set a timeout on the socket */ + apr_setsocketopt(sock, APR_SO_TIMEOUT, (int)(r->server->timeout * APR_USEC_PER_SEC)); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, "proxy: socket has been created");