[tor-commits] [ooni-probe/master] Integrate withoutbody optflag lost in rebase

art at torproject.org art at torproject.org
Fri Apr 29 09:42:24 UTC 2016


commit 31c3a81dba626d3defed46213c7e6d6bfde632d6
Author: Arturo Filastò <arturo at filasto.net>
Date:   Fri Feb 5 17:47:29 2016 +0100

    Integrate withoutbody optflag lost in rebase
---
 ooni/nettests/blocking/http_requests.py | 2 +-
 ooni/templates/httpt.py                 | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ooni/nettests/blocking/http_requests.py b/ooni/nettests/blocking/http_requests.py
index f21b041..e00b4c6 100644
--- a/ooni/nettests/blocking/http_requests.py
+++ b/ooni/nettests/blocking/http_requests.py
@@ -18,7 +18,7 @@ class UsageOptions(usage.Options):
         ['factor', 'f', 0.8,
          'What factor should be used for triggering censorship (0.8 == 80%)']]
     optFlags = [
-        ["withoutbody","B", "don't include HTTP response body inside of the report"],
+        ["withoutbody", "B", "don't include HTTP response body inside of the report"],
         ]
 
 
diff --git a/ooni/templates/httpt.py b/ooni/templates/httpt.py
index a49c39b..3a36b18 100644
--- a/ooni/templates/httpt.py
+++ b/ooni/templates/httpt.py
@@ -151,9 +151,13 @@ class HTTPTest(NetTestCase):
             }
         }
         if response:
+            if self.localOptions.get('withoutbody', 0) is 0:
+                response_body = _representBody(response_body)
+            else:
+                response_body = ''
             session['response'] = {
                 'headers': _representHeaders(response.headers),
-                'body': _representBody(response_body),
+                'body': response_body,
                 'code': response.code
         }
         session['failure'] = None





More information about the tor-commits mailing list