Ticket #1007: 0001-outbound-proxy-support.patch

File 0001-outbound-proxy-support.patch, 2.7 KB (added by killyourtv, at 2013-08-07T15:37:33Z)

outbound-proxy

  • src/allmydata/node.py

    From 1e943f511add4e177fbc5e7bc339444b8b09ad8a Mon Sep 17 00:00:00 2001
    From: KillYourTV <killyourtv@i2pmail.org>
    Date: Wed, 7 Aug 2013 15:00:23 +0000
    Subject: [PATCH 1/2] outbound proxy support
    
    ---
     src/allmydata/node.py                |    4 ++++
     src/allmydata/scripts/create_node.py |    1 +
     src/allmydata/test/test_system.py    |    6 +++---
     3 files changed, 8 insertions(+), 3 deletions(-)
    
    diff --git a/src/allmydata/node.py b/src/allmydata/node.py
    index 8873e5c..5792fd4 100644
    a b class Node(service.MultiService): 
    185185            # N.B.: this is in seconds, so use "1800" to get 30min
    186186            self.tub.setOption("disconnectTimeout", int(disconnect_timeout_s))
    187187
     188        outbound_proxy = self.get_config("node", "outbound_proxy", "")
     189        if outbound_proxy:
     190            self.tub.setOption("outbound-proxy", outbound_proxy)
     191
    188192        self.nodeid = b32decode(self.tub.tubID.upper()) # binary format
    189193        self.write_config("my_nodeid", b32encode(self.nodeid).lower() + "\n")
    190194        self.short_nodeid = b32encode(self.nodeid).lower()[:8] # ready for printing
  • src/allmydata/scripts/create_node.py

    diff --git a/src/allmydata/scripts/create_node.py b/src/allmydata/scripts/create_node.py
    index a27ed82..547f9aa 100644
    a b def write_node_config(c, config): 
    8787        webport = ""
    8888    c.write("web.port = %s\n" % (webport.encode('utf-8'),))
    8989    c.write("web.static = public_html\n")
     90    c.write("#outbound_proxy =\n")
    9091    c.write("#tub.port =\n")
    9192    c.write("#tub.location = \n")
    9293    c.write("#log_gatherer.furl =\n")
  • src/allmydata/test/test_system.py

    diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py
    index 56abc24..346302b 100644
    a b class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase): 
    17861786        d.addCallback(_run_in_subprocess, "put", "-", "newalias:tahoe-file", stdin=STDIN_DATA)
    17871787        d.addCallback(_check_succeeded, check_stderr=False)
    17881788
    1789         def _mv_with_http_proxy(ign):
     1789        def _mv_with_outbound_proxy(ign):
    17901790            env = os.environ
    1791             env['http_proxy'] = env['HTTP_PROXY'] = "http://127.0.0.0:12345"  # invalid address
     1791            env['outbound_proxy'] = env['HTTP_PROXY'] = "http://127.0.0.0:12345"  # invalid address
    17921792            return _run_in_subprocess(None, "mv", "newalias:tahoe-file", "newalias:tahoe-moved", env=env)
    1793         d.addCallback(_mv_with_http_proxy)
     1793        d.addCallback(_mv_with_outbound_proxy)
    17941794        d.addCallback(_check_succeeded)
    17951795
    17961796        d.addCallback(_run_in_subprocess, "ls", "newalias:")