From 4f9a6f576e3596d5dc162c7b0d15a4dd0175a389 Mon Sep 17 00:00:00 2001 From: Chuck Murcko Date: Tue, 14 Nov 2000 17:15:11 +0000 Subject: [PATCH] Simplify ap_proxy_doconnect(); now returns apr_status_t PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86961 13f79535-47bb-0310-9956-ffa450edef68 --- modules/proxy/mod_proxy.h | 2 +- modules/proxy/proxy_util.c | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index 75c4d5b0a9..951d9d8eb9 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -273,7 +273,7 @@ int ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p); int ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p); int ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p); int ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p); -int ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, request_rec *r); +apr_status_t ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, request_rec *r); int ap_proxy_garbage_init(server_rec *, apr_pool_t *); /* This function is called by ap_table_do() for all header lines */ int ap_proxy_send_hdr_line(void *p, const char *key, const char *value); diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index de47219f34..6338ca92be 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -1136,8 +1136,9 @@ static int proxy_match_word(struct dirconn_entry *This, request_rec *r) return host != NULL && ap_strstr_c(host, This->name) != NULL; } -int ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, request_rec *r) +apr_status_t ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, request_rec *r) { + apr_status_t rv; int i; for (i = 0; host[i] != '\0'; i++) @@ -1149,20 +1150,18 @@ int ap_proxy_doconnect(apr_socket_t *sock, char *host, apr_uint32_t port, reques apr_set_ipaddr(sock, APR_REMOTE, host); host = NULL; } - for(;;) + + do { - apr_status_t rv = apr_connect(sock, host); - if (APR_STATUS_IS_EINTR(rv)) - continue; - else if (rv == APR_SUCCESS) - return 0; - else { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy connect to %s port %d failed", host, port); - return -1; - } + rv = apr_connect(sock, host); + } while (APR_STATUS_IS_EINTR(rv)); + + if (rv != APR_SUCCESS) + { + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "proxy connect to %s port %d failed", host, port); } - return -1; + return rv; } /* This function is called by ap_table_do() for all header lines */ -- 2.40.0