[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Fix some crucial bugs in ooni.



commit b4ff20a2af67ca11ede6464777885a5547a155fd
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Mon Aug 19 17:32:21 2013 +0200

    Fix some crucial bugs in ooni.
    
    * We were not properly reading the response body
    * We were no longer supporting Nettest.inputs API
---
 ooni/nettest.py       |    5 ++++-
 ooni/utils/net.py     |    6 +++---
 ooni/utils/txscapy.py |    2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/ooni/nettest.py b/ooni/nettest.py
index 10eacd3..4c1c6fa 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -565,7 +565,7 @@ class NetTestCase(object):
     version = "0.0.0"
     description = "Sorry, this test has no description :("
 
-    inputs = [None]
+    inputs = None
     inputFile = None
     inputFilename = None
 
@@ -664,6 +664,9 @@ class NetTestCase(object):
             a generator that will yield one item from the file based on the
             inputProcessor.
         """
+        if self.inputs:
+            return self.inputs
+
         if self.inputFileSpecified:
             self.inputFilename = self.localOptions[self.inputFile[0]]
             return self.inputProcessor(self.inputFilename)
diff --git a/ooni/utils/net.py b/ooni/utils/net.py
index 67a98c2..e97d8c3 100644
--- a/ooni/utils/net.py
+++ b/ooni/utils/net.py
@@ -67,13 +67,13 @@ class BodyReceiver(protocol.Protocol):
         self.data = ""
         self.bytes_remaining = content_length
 
-    def dataReceived(self, bytes):
+    def dataReceived(self, b):
+        self.data += b
         if self.bytes_remaining:
             if self.bytes_remaining == 0:
                 self.connectionLost(None)
             else:
-                self.bytes_remaining -= len(bytes)
-        self.data += bytes
+                self.bytes_remaining -= len(b)
 
     def connectionLost(self, reason):
         self.finished.callback(self.data)
diff --git a/ooni/utils/txscapy.py b/ooni/utils/txscapy.py
index aaadbe7..a5bb841 100644
--- a/ooni/utils/txscapy.py
+++ b/ooni/utils/txscapy.py
@@ -109,7 +109,7 @@ def hasRawSocketPermission():
     try:
         send(IP(src="1.2.3.4", dst="127.0.0.1"))
         return True
-    except (socket.error, OSError):
+    except Exception:
         return False
 
 class ProtocolNotRegistered(Exception):

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits