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

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



commit cd1bc4b81ac41451a4d82d153dbdd888ad466cf1
Author: Arturo Filastò <art@xxxxxxxxx>
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



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