Re: [dev] Torified surf is unstable

From: GhostAV <ghostav_AT_riseup.net>
Date: Tue, 18 Aug 2015 12:46:34 +0200

On Tue, Aug 18, 2015 at 12:38:40PM +0200, Gabriel Pérez-Cerezo wrote:
> It really seems to be a problem with torsocks. I have already solved
> this problem with a patch GhostAV just sent me on this list that adds
> SOCKS support to surf. It works fine now.

As i failed to send the patch to the list, i resend it now:
-- >8 --
From: Jonas Rabenstein <jonas.rabenstein_AT_studium.uni-erlangen.de>
Subject: [PATCH] allow sock proxies
---
 surf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/surf.c b/surf.c
index 6e28f0a..3588015 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -1349,8 +1349,12 @@ setup(void) {
 
 	/* proxy */
 	if((proxy = getenv("http_proxy")) && strcmp(proxy, "")) {
-		new_proxy = g_strrstr(proxy, "http://") ? g_strdup(proxy) :
-			g_strdup_printf("http://%s", proxy);
+		new_proxy = g_strrstr(proxy, "http://")
+            || g_strrstr(proxy, "socks://")
+            || g_strrstr(proxy, "socks4://")
+            || g_strrstr(proxy, "socks5://")
+            ? g_strdup(proxy)
+            : g_strdup_printf("http://%s", proxy);
 		puri = soup_uri_new(new_proxy);
 		g_object_set(G_OBJECT(s), "proxy-uri", puri, NULL);
 		soup_uri_free(puri);
-- 
2.5.0
Received on Tue Aug 18 2015 - 12:46:34 CEST

This archive was generated by hypermail 2.3.0 : Tue Aug 18 2015 - 12:48:26 CEST