From: Francois Deppierraz <francois@ctrlaltdel.ch>
Date: Fri, 30 Apr 2010 18:56:09 +0000 (-0700)
Subject: CLI: Support for https url in option --node-url
X-Git-Url: https://git.rkrishnan.org/pf/content/simplejson/provisioning?a=commitdiff_plain;h=dd95e8e71bc4e5b680f6d2a940a6d3f3141e5fb7;p=tahoe-lafs%2Ftahoe-lafs.git

CLI: Support for https url in option --node-url

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.
---

diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py
index f02d2c35..823f7458 100644
--- a/src/allmydata/scripts/cli.py
+++ b/src/allmydata/scripts/cli.py
@@ -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 = [
diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py
index 3503b1bc..c65474f8 100644
--- a/src/allmydata/test/test_cli.py
+++ b/src/allmydata/test/test_cli.py
@@ -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()