[tor-commits] [ooni-probe/master] Fine tune http url list test
art at torproject.org
art at torproject.org
Thu Nov 22 14:34:36 UTC 2012
commit df509b6ac8e090ee2f5d53e28bcdc59e645e7cb6
Author: Arturo Filastò <art at fuffa.org>
Date: Thu Nov 22 15:34:25 2012 +0100
Fine tune http url list test
---
nettests/core/http_url_list.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/nettests/core/http_url_list.py b/nettests/core/http_url_list.py
index c0e2fc8..358ab20 100644
--- a/nettests/core/http_url_list.py
+++ b/nettests/core/http_url_list.py
@@ -6,6 +6,7 @@
from twisted.internet import defer
from twisted.python import usage
from ooni.templates import httpt
+from ooni.utils import log
class UsageOptions(usage.Options):
optParameters = [['content', 'c', None,
@@ -56,14 +57,21 @@ class HTTPURLList(httpt.HTTPTest):
response_page = iter(body.split("\n"))
for censorship_line in censorship_page.xreadlines():
- response_line = response_page.next()
+ try:
+ response_line = response_page.next()
+ except StopIteration:
+ # The censored page and the response we got do not match in
+ # length.
+ self.report['censored'] = False
+ censorship_line = censorship_line.replace("\n", "")
if response_line != censorship_line:
self.report['censored'] = False
- break
+
censorship_page.close()
def processResponseBody(self, body):
if self.localOptions['content']:
+ log.msg("Checking for censorship in response body")
self.check_for_content_censorship(body)
def test_get(self):
More information about the tor-commits
mailing list