diff --git src/allmydata/node.py src/allmydata/node.py index 7f5bf61..f55ba3f 100644 --- src/allmydata/node.py +++ src/allmydata/node.py @@ -155,6 +155,10 @@ class Node(service.MultiService): # N.B.: this is in seconds, so use "1800" to get 30min self.tub.setOption("disconnectTimeout", int(disconnect_timeout_s)) + http_proxy = self.get_config("node", "http_proxy", "") + if http_proxy: + self.tub.setOption("http-proxy", http_proxy) + self.nodeid = b32decode(self.tub.tubID.upper()) # binary format self.write_config("my_nodeid", b32encode(self.nodeid).lower() + "\n") self.short_nodeid = b32encode(self.nodeid).lower()[:8] # ready for printing diff --git src/allmydata/scripts/create_node.py src/allmydata/scripts/create_node.py index 928add1..ff514d5 100644 --- src/allmydata/scripts/create_node.py +++ src/allmydata/scripts/create_node.py @@ -79,6 +79,7 @@ def write_node_config(c, config): webport = "" c.write("web.port = %s\n" % (webport.encode('utf-8'),)) c.write("web.static = public_html\n") + c.write("#http_proxy =\n") c.write("#tub.port =\n") c.write("#tub.location = \n") c.write("#log_gatherer.furl =\n") diff --git src/allmydata/test/test_node.py src/allmydata/test/test_node.py index 24ec571..08593ef 100644 --- src/allmydata/test/test_node.py +++ src/allmydata/test/test_node.py @@ -31,6 +31,17 @@ class TestCase(testutil.SignalMixin, unittest.TestCase): d.addCallback(flushEventualQueue) return d + def test_http_proxy(self): + basedir = "test_node/test_http_proxy" + fileutil.make_dirs(basedir) + f = open(os.path.join(basedir, 'tahoe.cfg'), 'wt') + f.write("[node]\n") + f.write("http_proxy = 127.0.0.1:8888\n") + f.close() + + n = TestNode(basedir) + self.failUnlessEqual(n.tub.options['http-proxy'], "127.0.0.1:8888") + def test_location(self): basedir = "test_node/test_location" fileutil.make_dirs(basedir)