[tor-commits] [ooni-probe/develop] Fix #8440, set the self.host attribute when given the --host option.

isis at torproject.org isis at torproject.org
Thu Jun 6 16:41:38 UTC 2013

commit 044227d4f553ca4996a6c3e289c0df547025317b
Author: Isis Lovecruft <isis at torproject.org>
Date:   Mon Apr 22 00:29:25 2013 +0000

    Fix #8440, set the self.host attribute when given the --host option.
     * Port option doesn't need to be fixed. It does what the option help string
       always said it does (which is actually slightly confusing and perhaps should
       be changed): it sets *all* the hosts' ports to --port. So, given a file of
       host:ports and a '--host' cmdline option, if also given '--port
       443', it will check every host, both in the file and the cmdline directives,
       on port 443. This is useful for checking a specific port, like if we wanted
       to check TLSv1 on the IMAPS (993) port for every host.
 nettests/experimental/tls_handshake.py |   19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/nettests/experimental/tls_handshake.py b/nettests/experimental/tls_handshake.py
index 35955dc..1ac3661 100644
--- a/nettests/experimental/tls_handshake.py
+++ b/nettests/experimental/tls_handshake.py
@@ -147,22 +147,11 @@ class HandshakeTest(nettest.NetTestCase):
             options = self.localOptions
             ## check that we're testing an IP:PORT, else exit gracefully:
-            if not ((options['host'] and options['port']) or options['file']):
-                 sys.exit("Need --host and --port, or --file!")
+            if not (options['host']  or options['file']):
+                raise SystemExit("Need --host or --file!")
+            if options['host']:
+                self.host = options['host']
-            ## xxx TODO there's nothing that tells the user they can only have
-            ##     one of the TLS/SSL methods at a time.
-            ## set the SSL/TLS method to use:
-            if options['ssl2']:
-                if not options['ssl3']:
-                    self.context = SSL.Context(SSL.SSLv2_METHOD)
-                else:
-                    self.context = SSL.Context(SSL.SSLv23_METHOD)
-            elif options['ssl3']:
-                self.context = SSL.Context(SSL.SSLv3_METHOD)
-            elif options['tls1']:
-                self.context = SSL.Context(SSL.TLSv1_METHOD)
                     raise NoSSLContextError(

More information about the tor-commits mailing list