From: Chuck Murcko Date: Tue, 14 Nov 2000 19:32:03 +0000 (+0000) Subject: Changes for previous ap_proxy_doconnect() calling X-Git-Tag: APACHE_2_0_ALPHA_8~64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b8f7395d751316f75b6c70ef891e4f61ad82402;p=apache Changes for previous ap_proxy_doconnect() calling PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86963 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/proxy_connect.c b/modules/proxy/proxy_connect.c index e93c51a55f..8decafb581 100644 --- a/modules/proxy/proxy_connect.c +++ b/modules/proxy/proxy_connect.c @@ -180,11 +180,11 @@ int ap_proxy_connect_handler(request_rec *r, ap_cache_el *c, char *url, } if (ap_proxy_doconnect(sock, (char *)(proxyhost ? proxyhost : host), - proxyport ? proxyport : port, r) == -1) { + proxyport ? proxyport : port, r) != APR_SUCCESS) { apr_close_socket(sock); return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, apr_pstrcat(r->pool, "Could not connect to remote machine:
", - strerror(errno), NULL)); + proxyhost, NULL)); } /* If we are connecting through a remote proxy, we need to pass diff --git a/modules/proxy/proxy_ftp.c b/modules/proxy/proxy_ftp.c index 59b90ef329..dc6cd9083a 100644 --- a/modules/proxy/proxy_ftp.c +++ b/modules/proxy/proxy_ftp.c @@ -590,11 +590,11 @@ int ap_proxy_ftp_handler(request_rec *r, ap_cache_el *c, char *url) #endif /*_OSD_POSIX*/ } - if (ap_proxy_doconnect(sock, host, port, r) == -1) { + if (ap_proxy_doconnect(sock, host, port, r) != APR_SUCCESS) { apr_close_socket(sock); return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_pstrcat(r->pool, "Could not connect to remote machine: ", - strerror(errno), NULL)); + host, NULL)); } f = ap_bcreate(p, B_RDWR); @@ -849,11 +849,12 @@ int ap_proxy_ftp_handler(request_rec *r, ap_cache_el *c, char *url) ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL, "FTP: contacting host %d.%d.%d.%d:%d", h3, h2, h1, h0, pport); - if (ap_proxy_doconnect(dsock, inet_ntoa(destaddr), pport, r) == -1) { +/* scary */ + if (ap_proxy_doconnect(dsock, inet_ntoa(destaddr), pport, r) == APR_SUCCESS) { return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_pstrcat(r->pool, "Could not connect to remote machine: ", - strerror(errno), NULL)); + inet_ntoa(destaddr), NULL)); } else { pasvmode = 1; diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index 48c5deed62..a7493cd2eb 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -174,6 +174,7 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url, char *desthost; apr_socket_t *sock; int i, len, backasswards, content_length = -1; + apr_status_t err; apr_array_header_t *reqhdrs_arr; apr_table_t *resp_hdrs = NULL; apr_table_entry_t *reqhdrs; @@ -256,19 +257,19 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url, #endif if (proxyhost != NULL) { - i = ap_proxy_doconnect(sock, (char *)proxyhost, proxyport, r); + err = ap_proxy_doconnect(sock, (char *)proxyhost, proxyport, r); } else { - i = ap_proxy_doconnect(sock, (char *)desthost, destport, r); + err = ap_proxy_doconnect(sock, (char *)desthost, destport, r); } - if (i == -1) { + if (err != APR_SUCCESS) { if (proxyhost != NULL) return DECLINED; /* try again another way */ else return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_pstrcat(r->pool, "Could not connect to remote machine: ", - strerror(errno), NULL)); + desthost, NULL)); } clear_connection(r->pool, r->headers_in); /* Strip connection-based headers */