[tor-commits] [stem/master] Loosen check for ssl connection errors

atagar at torproject.org atagar at torproject.org
Fri Feb 9 20:10:55 UTC 2018


commit f76d64d4bc7c9522a63faeee6c9c667458e1600d
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Feb 9 12:08:12 2018 -0800

    Loosen check for ssl connection errors
    
    Jenkins is getting a different SSL error response than what I see locally when
    attempted to treat the ControlPort like an ORPort. Loosening the conditional.
    I'm tempted to include the exception string in the message but it's kinda
    verbose. Maybe I'll do a regex to pluck out the useful bit in the future if
    folks would find it useful.
    
      ======================================================================
      FAIL: test_not_orport
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/test/integ/client/connection.py", line 34, in test_not_orport
          self.assertRaisesRegexp(stem.SocketError, "Failed to SSL authenticate to 127.0.0.1:1111. Maybe it isn't an ORPort?", Relay.connect, '127.0.0.1', test.runner.CONTROL_PORT)
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/stem/util/test_tools.py", line 278, in assertRaisesRegexp
          return super(original_type, self).assertRaisesRegexp(exc_type, exc_msg, func, *args, **kwargs)
      AssertionError: "Failed to SSL authenticate to 127.0.0.1:1111. Maybe it isn't an ORPort?" does not match "[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:661)"
    
      ----------------------------------------------------------------------
---
 stem/client/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stem/client/__init__.py b/stem/client/__init__.py
index 340082c7..2c6b7ea6 100644
--- a/stem/client/__init__.py
+++ b/stem/client/__init__.py
@@ -83,7 +83,7 @@ class Relay(object):
     except stem.SocketError as exc:
       if 'Connection refused' in str(exc):
         raise stem.SocketError("Failed to connect to %s:%i. Maybe it isn't an ORPort?" % (address, port))
-      elif 'SSL: UNKNOWN_PROTOCOL' in str(exc):
+      elif 'SSL: ' in str(exc):
         raise stem.SocketError("Failed to SSL authenticate to %s:%i. Maybe it isn't an ORPort?" % (address, port))
       else:
         raise



More information about the tor-commits mailing list