[tor-commits] [ooni-probe/master] Also check if the attributes exist

art at torproject.org art at torproject.org
Tue Aug 19 11:50:21 UTC 2014


commit cd1bc4b81ac41451a4d82d153dbdd888ad466cf1
Author: Arturo Filastò <art at fuffa.org>
Date:   Tue Aug 19 13:09:47 2014 +0200

    Also check if the attributes exist
---
 ooni/nettests/blocking/http_requests.py |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ooni/nettests/blocking/http_requests.py b/ooni/nettests/blocking/http_requests.py
index d37489e..997fb4e 100644
--- a/ooni/nettests/blocking/http_requests.py
+++ b/ooni/nettests/blocking/http_requests.py
@@ -131,10 +131,12 @@ class HTTPRequestsTest(httpt.HTTPTest):
                     control = measurement.result
 
         if experiment and control:
-            if experiment.body and control.body:
+            if hasattr(experiment, 'body') and hasattr(control, 'body') \
+                    and experiment.body and control.body:
                 self.compare_body_lengths(len(control.body),
-                                        len(experiment.body))
-            if experiment.headers and control.headers:
+                                          len(experiment.body))
+            if hasattr(experiment, 'headers') and hasattr(control, 'headers') \
+                    and experiment.headers and control.headers:
                 self.compare_headers(control.headers,
-                                    experiment.headers)
+                                     experiment.headers)
         return self.report





More information about the tor-commits mailing list