]> git.lizzy.rs Git - torbrowser-launcher.git/commitdiff
error message for socks failures (Closes: #797337)
authorHolger Levsen <holger@layer-acht.org>
Tue, 1 Mar 2016 15:59:42 +0000 (16:59 +0100)
committerHolger Levsen <holger@layer-acht.org>
Wed, 2 Mar 2016 14:58:43 +0000 (15:58 +0100)
thanks to Michael Gold <michael@bitplane.org>

torbrowser_launcher/launcher.py

index e32f2db371b6d0c330a17de40488a3222c6b28a3..2c95352f9e212be222f8cf91663dfc079271d04f 100644 (file)
@@ -32,7 +32,7 @@ from twisted.web.client import Agent, RedirectAgent, ResponseDone, ResponseFaile
 from twisted.web.http_headers import Headers
 from twisted.web.iweb import IPolicyForHTTPS
 from twisted.internet.protocol import Protocol
-from twisted.internet.error import DNSLookupError
+from twisted.internet.error import DNSLookupError, ConnectionRefusedError
 
 import xml.etree.ElementTree as ET
 
@@ -363,6 +363,13 @@ class Launcher:
                     else:
                         self.set_gui('error', _('The SSL certificate served by https://www.torproject.org is invalid! You may be under attack.'), [], False)
 
+        elif isinstance(f.value, ConnectionRefusedError) and self.common.settings['download_over_tor']:
+            # If we're using Tor, we'll only get this error when we fail to
+            # connect to the SOCKS server.  If the connection fails at the
+            # remote end, we'll get txsocksx.errors.ConnectionRefused.
+            addr = self.common.settings['tor_socks_address']
+            self.set_gui('error', _("Error connecting to Tor at {0}").format(addr), [], False)
+
         else:
             self.set_gui('error', _("Error starting download:\n\n{0}\n\nAre you connected to the internet?").format(f.value), [], False)