1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

socks.c: improve verbose output of SOCKS5 connection sequence

This commit is contained in:
Marc Hoersken 2016-08-20 20:07:10 +02:00
parent 8f7f5a8b06
commit d1bfb1cf54

View File

@ -606,7 +606,6 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
saddr_in = (struct sockaddr_in*)(void*)hp->ai_addr; saddr_in = (struct sockaddr_in*)(void*)hp->ai_addr;
for(i = 0; i < 4; i++) { for(i = 0; i < 4; i++) {
socksreq[len++] = ((unsigned char*)&saddr_in->sin_addr.s_addr)[i]; socksreq[len++] = ((unsigned char*)&saddr_in->sin_addr.s_addr)[i];
infof(data, "%d\n", socksreq[len-1]);
} }
} }
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
@ -629,6 +628,25 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
hostname); hostname);
return CURLE_COULDNT_RESOLVE_HOST; 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 */ socksreq[len++] = (unsigned char)((remote_port >> 8) & 0xff); /* PORT MSB */