From d1bfb1cf54d3e862581fb12590ee845da39869e4 Mon Sep 17 00:00:00 2001 From: Marc Hoersken Date: Sat, 20 Aug 2016 20:07:10 +0200 Subject: socks.c: improve verbose output of SOCKS5 connection sequence --- lib/socks.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/socks.c b/lib/socks.c index b6bc4e17c..bee43ac2b 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -606,7 +606,6 @@ CURLcode Curl_SOCKS5(const char *proxy_name, saddr_in = (struct sockaddr_in*)(void*)hp->ai_addr; for(i = 0; i < 4; i++) { socksreq[len++] = ((unsigned char*)&saddr_in->sin_addr.s_addr)[i]; - infof(data, "%d\n", socksreq[len-1]); } } #ifdef ENABLE_IPV6 @@ -629,6 +628,25 @@ CURLcode Curl_SOCKS5(const char *proxy_name, hostname); return CURLE_COULDNT_RESOLVE_HOST; } + else { + if(socksreq[3] == 1) { + infof(data, "SOCKS5 connect to %d.%d.%d.%d (locally resolved)\n", + (unsigned char)socksreq[4], (unsigned char)socksreq[5], + (unsigned char)socksreq[6], (unsigned char)socksreq[7]); + } + else if(socksreq[3] == 4) { + infof(data, "SOCKS5 connect to %02x%02x:%02x%02x:%02x%02x:%02x%02x:" + "%02x%02x:%02x%02x:%02x%02x:%02x%02x (locally resolved)\n", + (unsigned char)socksreq[4], (unsigned char)socksreq[5], + (unsigned char)socksreq[6], (unsigned char)socksreq[7], + (unsigned char)socksreq[8], (unsigned char)socksreq[9], + (unsigned char)socksreq[10], (unsigned char)socksreq[11], + (unsigned char)socksreq[12], (unsigned char)socksreq[13], + (unsigned char)socksreq[14], (unsigned char)socksreq[15], + (unsigned char)socksreq[16], (unsigned char)socksreq[17], + (unsigned char)socksreq[18], (unsigned char)socksreq[19]); + } + } } socksreq[len++] = (unsigned char)((remote_port >> 8) & 0xff); /* PORT MSB */ -- cgit v1.2.3