From bd5df120f4a48869f9d85774af1cebaba00de1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 13 Sep 2006 17:08:19 +0000 Subject: Don't use the proxy if the host resolves to 127.0.0.1 (localhost). Missing check for IPv6 localhost. CVS patchset: 8224 CVS date: 2006/09/13 17:08:19 --- src/input/input_http.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/input/input_http.c b/src/input/input_http.c index 874cb891c..5de03e50b 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -19,7 +19,7 @@ * * input plugin for http network streams * - * $Id: input_http.c,v 1.120 2006/07/10 22:08:15 dgp85 Exp $ + * $Id: input_http.c,v 1.121 2006/09/13 17:08:19 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -176,6 +176,16 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { return 1; } if (!info->h_name) return 1; + + if ( info->h_addr_list[0] ) { + /* \177\0\0\1 is the *octal* representation of 127.0.0.1 */ + if ( info->h_addrtype == AF_INET && !memcmp(info->h_addr_list[0], "\177\0\0\1", 4) ) { + lprintf("host '%s' is localhost\n", host); + return 1; + } + /* TODO: IPv6 check */ + } + target = info->h_name; host_len = strlen(target); -- cgit v1.2.3