Control: tag -1 + patch

On Sun, Aug 30, 2015 at 13:18:44 +0200, intrigeri wrote:
> Michael Gold wrote (29 Aug 2015 16:35:00 GMT) :
> > An strace reveals it was trying to connect to 127.0.0.1:9050, not to the
> > internet; code inspection reveals this to be a hard-coded SOCKS address.
> > The preceding "Downloading https://www.torproject.org…"; message makes it
> > look like it was www.torproject.org that rejected the connection.
> 
> I agree this is a UX problem, thanks for reporting it to Debian.
> Do you want to report it upstream[0]? (I don't remember if the
> upstream author tracks the Debian BTS.)

Here's a patch.  I don't have an account there so I'm CCing Micah.

I didn't handle the case where the remote end rejects the connection.
I'm not sure what exactly it should say, but "Are you connected to the
internet?" isn't relevant in that case.

-- Michael
diff --git a/torbrowser_launcher/launcher.py b/torbrowser_launcher/launcher.py
index e88a9f0ca87d..c830750e98fa 100644
--- a/torbrowser_launcher/launcher.py
+++ b/torbrowser_launcher/launcher.py
@@ -32,7 +32,7 @@ from twisted.web.client import Agent, RedirectAgent, ResponseDone, ResponseFaile
 from twisted.web.http_headers import Headers
 from twisted.internet.protocol import Protocol
 from twisted.internet.ssl import ClientContextFactory
-from twisted.internet.error import DNSLookupError
+from twisted.internet.error import DNSLookupError, ConnectionRefusedError
 
 import OpenSSL
 
@@ -426,6 +426,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['update_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)
 

Attachment: signature.asc
Description: PGP signature

Reply via email to