]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
CLI: Support for https url in option --node-url
authorFrancois Deppierraz <francois@ctrlaltdel.ch>
Fri, 30 Apr 2010 18:56:09 +0000 (11:56 -0700)
committerFrancois Deppierraz <francois@ctrlaltdel.ch>
Fri, 30 Apr 2010 18:56:09 +0000 (11:56 -0700)
This patch modifies the regular expression used for verifying of '--node-url'
parameter.  Support for accessing a Tahoe gateway over HTTPS was already
present, thanks to Python's urllib.

src/allmydata/scripts/cli.py
src/allmydata/test/test_cli.py

index f02d2c350ffa26469348c89a5ad094374c33e674..823f745860292030a05ef16b77e1f19f636fa5ea 100644 (file)
@@ -2,7 +2,7 @@ import os.path, re, sys, fnmatch
 from twisted.python import usage
 from allmydata.scripts.common import BaseOptions, get_aliases
 
-NODEURL_RE=re.compile("http://([^:]*)(:([1-9][0-9]*))?")
+NODEURL_RE=re.compile("http(s?)://([^:]*)(:([1-9][0-9]*))?")
 
 class VDriveOptions(BaseOptions, usage.Options):
     optParameters = [
index 3503b1bc072746bad5f8613c30135e75f5a5d150..c65474f831945c4d12a25c6a36b074fac684747b 100644 (file)
@@ -88,6 +88,11 @@ class CLI(unittest.TestCase):
                         "--node-url", "http://localhost:8080"])
         self.failUnlessEqual(o["node-url"], "http://localhost:8080/")
 
+        o = cli.ListOptions()
+        o.parseOptions(["--node-directory", "cli/test_options",
+                        "--node-url", "https://localhost/"])
+        self.failUnlessEqual(o["node-url"], "https://localhost/")
+
     def _dump_cap(self, *args):
         config = debug.DumpCapOptions()
         config.stdout,config.stderr = StringIO(), StringIO()