You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rodent of Unusual Size <co...@decus.org> on 1997/08/17 20:31:30 UTC

[PATCH] PR#352 - add IP address to error messages (take 2)

>From the fingers of Marc Slemko flowed the following:
>
>[Sun Aug 17 12:08:57 1997] connect: 127.0.0.1: Connection refused
>[Sun Aug 17 12:08:57 1997] connect: 10.0.0.1: No route to host
>
>It doesn't work correctly using ProxyRemote because
>r->connection->remote_ip isn't always the address we are trying to
>connect.  Try:
>
>        proxy_log_uerror("connect", inet_ntoa(addr->sin_addr), NULL,
>r->server);
>
>instead.

    D'oh!  Okey, reworked patch here.. Proxy users, please vet.

    #ken    :-)}


Index: proxy_util.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_util.c,v
retrieving revision 1.22
diff -u -r1.22 proxy_util.c
--- proxy_util.c	1997/07/27 03:13:34	1.22
+++ proxy_util.c	1997/08/17 18:29:36
@@ -1168,9 +1168,10 @@
             errno = WSAGetLastError() - WSABASEERR;
 #endif /* WIN32 */
     } while (i == -1 && errno == EINTR);
-    if (i == -1) proxy_log_uerror("connect", NULL, NULL, r->server);
+    if (i == -1) {
+	proxy_log_uerror("connect", inet_ntoa(addr->sin_addr), NULL, r->server);
+    }
     kill_timeout(r);
 
     return i;
 }
-

Re: [PATCH] PR#352 - add IP address to error messages (take 2)

Posted by Marc Slemko <ma...@worldgate.com>.
No, you should also report the port number.

Try something like:

    if (i == -1) {
        char host[128];
        snprintf(host, sizeof(host), 
            "%s port %d", inet_ntoa(addr->sin_addr), ntohs(addr->sin_port));
        proxy_log_uerror("connect", host, NULL, r->server);
    }

(yes, yes... it would be easier if I thought of all this at the same
time...)

On Sun, 17 Aug 1997, Rodent of Unusual Size wrote:

> >From the fingers of Marc Slemko flowed the following:
> >
> >[Sun Aug 17 12:08:57 1997] connect: 127.0.0.1: Connection refused
> >[Sun Aug 17 12:08:57 1997] connect: 10.0.0.1: No route to host
> >
> >It doesn't work correctly using ProxyRemote because
> >r->connection->remote_ip isn't always the address we are trying to
> >connect.  Try:
> >
> >        proxy_log_uerror("connect", inet_ntoa(addr->sin_addr), NULL,
> >r->server);
> >
> >instead.
> 
>     D'oh!  Okey, reworked patch here.. Proxy users, please vet.
> 
>     #ken    :-)}
> 
> 
> Index: proxy_util.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_util.c,v
> retrieving revision 1.22
> diff -u -r1.22 proxy_util.c
> --- proxy_util.c	1997/07/27 03:13:34	1.22
> +++ proxy_util.c	1997/08/17 18:29:36
> @@ -1168,9 +1168,10 @@
>              errno = WSAGetLastError() - WSABASEERR;
>  #endif /* WIN32 */
>      } while (i == -1 && errno == EINTR);
> -    if (i == -1) proxy_log_uerror("connect", NULL, NULL, r->server);
> +    if (i == -1) {
> +	proxy_log_uerror("connect", inet_ntoa(addr->sin_addr), NULL, r->server);
> +    }
>      kill_timeout(r);
>  
>      return i;
>  }
> -
>