]> granicus.if.org Git - apache/commitdiff
Changes for previous ap_proxy_doconnect() calling
authorChuck Murcko <chuck@apache.org>
Tue, 14 Nov 2000 19:32:03 +0000 (19:32 +0000)
committerChuck Murcko <chuck@apache.org>
Tue, 14 Nov 2000 19:32:03 +0000 (19:32 +0000)
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

modules/proxy/proxy_connect.c
modules/proxy/proxy_ftp.c
modules/proxy/proxy_http.c

index e93c51a55f52e803c8f9f97f8508f97699fe10b7..8decafb581ff48259e8613f479e34b4bcff13fd1 100644 (file)
@@ -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:<br>",
-            strerror(errno), NULL));
+            proxyhost, NULL));
     }
 
     /* If we are connecting through a remote proxy, we need to pass
index 59b90ef32945f3ad44423f87c70cc660e8944660..dc6cd9083ae83604bd7588ef471e8d1b918f2f62 100644 (file)
@@ -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;
index 48c5deed62301329c6852459ae5bdf0d0640dec1..a7493cd2ebbb53cb133a9ca8907c72dc3847056e 100644 (file)
@@ -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 */