commit 0ac3aebb8840967c4bd9598191e96050e3e54218
parent d0308010da5053c405c0ad269542e9a7449e9bfd
Author: ThomasV <thomasv@gitorious>
Date: Wed, 1 Jul 2015 08:45:47 +0200
fix proxy setting issue #1330
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/network.py b/lib/network.py
@@ -301,11 +301,12 @@ class Network(util.DaemonThread):
def set_proxy(self, proxy):
self.proxy = proxy
if proxy:
+ self.print_error("setting proxy", proxy)
proxy_mode = proxy_modes.index(proxy["mode"]) + 1
socks.setdefaultproxy(proxy_mode, proxy["host"], int(proxy["port"]))
socket.socket = socks.socksocket
# prevent dns leaks, see http://stackoverflow.com/questions/13184205/dns-over-proxy
- socket.getaddrinfo = lambda *args: [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))]
+ socket.getaddrinfo = lambda *args: [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (str(args[0]), args[1]))]
else:
socket.socket = socket._socketobject
socket.getaddrinfo = socket._socket.getaddrinfo