[tor-commits] [ooni-probe/master] Fix a couple of bugs inside of oonibclient.

art at torproject.org art at torproject.org
Fri Feb 28 14:32:21 UTC 2014


commit 90d2c9e40916a9f8f3c5c9476eb6d00f92d3656e
Author: Arturo Filastò <art at fuffa.org>
Date:   Fri Jan 31 13:40:02 2014 +0100

    Fix a couple of bugs inside of oonibclient.
---
 ooni/oonibclient.py |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/ooni/oonibclient.py b/ooni/oonibclient.py
index 60771b6..be5804f 100644
--- a/ooni/oonibclient.py
+++ b/ooni/oonibclient.py
@@ -47,10 +47,10 @@ class OONIBClient(object):
     def __init__(self, address):
         self.address = address
 
-
     def _request(self, method, urn, genReceiver, bodyProducer=None):
+        address = self.address
         if self.address.startswith('httpo://'):
-            self.address = self.address.replace('httpo://', 'http://')
+            address = self.address.replace('httpo://', 'http://')
             agent = TrueHeadersSOCKS5Agent(reactor,
                 proxyEndpoint=TCP4ClientEndpoint(reactor, '127.0.0.1',
                     config.tor.socks_port))
@@ -59,18 +59,16 @@ class OONIBClient(object):
             log.err("HTTPS based bouncers are currently not supported.")
             raise e.InvalidOONIBBouncerAddress
 
-        elif address.startswith('http://'):
+        elif self.address.startswith('http://'):
             log.msg("Warning using unencrypted collector")
-            self.address = address
-            self.agent = Agent(reactor)
+            agent = Agent(reactor)
 
-    def _request(self, method, urn, genReceiver, bodyProducer=None):
         attempts = 0
 
         finished = defer.Deferred()
 
         def perform_request(attempts):
-            uri = self.address + urn
+            uri = address + urn
             headers = {}
             d = agent.request(method, uri, bodyProducer=bodyProducer)
 





More information about the tor-commits mailing list