changeset 7982:58af482c89f7

[gaim-migrate @ 8659] " When any error condition is returned by a socks5 proxy, the debug window just shows "Bad data". This patch shows the error message corresponding to the returned error code, so that the user may know why the socks5 proxy is refusing to process the request. Background: I'd been trying to establish why I couldn't connect to MSN through SOCKS5. Adding this patch enabled me to see that it wsan't a bug in gaim as I'd originally thought, but that the proxy server I was using was configured to deny connections to nexus.passport.com:443." --Gavan Fantom (gavan) committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 04 Jan 2004 04:27:17 +0000
parents ad5c8f01882b
children e824dad301ef
files src/proxy.c
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/proxy.c	Sat Jan 03 16:22:44 2004 +0000
+++ b/src/proxy.c	Sun Jan 04 04:27:17 2004 +0000
@@ -59,6 +59,18 @@
 
 } GaimIOClosure;
 
+const char* socks5errors[] = {
+	"succeeded\n",
+	"general SOCKS server failure\n",
+	"connection not allowed by ruleset\n",
+	"Network unreachable\n",
+	"Host unreachable\n",
+	"Connection refused\n",
+	"TTL expired\n",
+	"Command not supported\n",
+	"Address type not supported\n"
+};
+
 /**************************************************************************
  * Proxy structure API
  **************************************************************************/
@@ -1316,7 +1328,10 @@
 		return;
 	}
 	if ((buf[0] != 0x05) || (buf[1] != 0x00)) {
-		gaim_debug(GAIM_DEBUG_ERROR, "socks5 proxy", "Bad data.\n");
+		if ((buf[0] == 0x05) && (buf[1] < 0x09))
+			gaim_debug(GAIM_DEBUG_ERROR, "socks5 proxy", socks5errors[buf[1]]);
+		else
+			gaim_debug(GAIM_DEBUG_ERROR, "socks5 proxy", "Bad data.\n");
 		close(source);
 
 		if (phb->account == NULL ||