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

[tor-commits] [ooni-probe/master] Do not swallow failures in http_requests



commit 3d2b9025ca372ca0fcdb88ce6e2cb050c1cf6e64
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Wed Sep 18 12:09:46 2013 +0200

    Do not swallow failures in http_requests
    
    The callback attached to the deferredList previously swallowed failures,
    such that any errors would never reach the errbacks attached and
    therefore the test would not get rescheduled.
---
 ooni/nettests/blocking/http_requests.py |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/ooni/nettests/blocking/http_requests.py b/ooni/nettests/blocking/http_requests.py
index 8c74762..4e7d582 100644
--- a/ooni/nettests/blocking/http_requests.py
+++ b/ooni/nettests/blocking/http_requests.py
@@ -102,12 +102,19 @@ class HTTPRequestsTest(httpt.HTTPTest):
 
                 self.compare_headers(control_result.headers,
                         experiment_result.headers)
-
-            if not control_succeeded:
-                self.report['control_failure'] = failureToString(control_result)
-
-            if not experiment_succeeded:
-                self.report['experiment_failure'] = failureToString(experiment_result)
+            else:
+                if not control_succeeded:
+                    self.report['control_failure'] = failureToString(control_result)
+    
+                if not experiment_succeeded:
+                    self.report['experiment_failure'] = failureToString(experiment_result)
+                # Now return some kind of failure so we can retry
+                # However, it would be ideal to split this test into two methods
+                # and compare the results in the postProcessor
+                # Sadly the postProcessor API is currently not implemented
+                if control_succeeded:
+                    return experiment_result
+                return control_result
 
         headers = {'User-Agent': [random.choice(userAgents)]}
 



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