[tor-commits] [stem/master] Skip port validity for Controller.from_port() with the default

atagar at torproject.org atagar at torproject.org
Sat May 23 19:34:15 UTC 2015


commit 6c40ef5779db5d1b6ffc6f75720c972dd6258f0c
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat May 23 12:32:14 2015 -0700

    Skip port validity for Controller.from_port() with the default
    
    Oops, we shouldn't try to validate the port when it's 'default'. Our tests
    caught this for the connection module, but didn't exercise it here.
---
 stem/control.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stem/control.py b/stem/control.py
index 26272fd..544e3a2 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -920,7 +920,7 @@ class Controller(BaseController):
 
     if not stem.util.connection.is_valid_ipv4_address(address):
       raise ValueError('Invalid IP address: %s' % address)
-    elif not stem.util.connection.is_valid_port(port):
+    elif port != 'default' and not stem.util.connection.is_valid_port(port):
       raise ValueError('Invalid port: %s' % port)
 
     if port == 'default':



More information about the tor-commits mailing list