[tor-commits] [ooni-probe/master] If we don't find the content length header set it to None

art at torproject.org art at torproject.org
Fri Jan 3 13:29:42 UTC 2014


commit 215cd51cc23d018b70683ad540727f70856e6867
Author: Arturo Filastò <art at fuffa.org>
Date:   Fri Dec 27 15:01:04 2013 +0100

    If we don't find the content length header set it to None
---
 ooni/templates/httpt.py |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ooni/templates/httpt.py b/ooni/templates/httpt.py
index 04c0708..f9b9d36 100644
--- a/ooni/templates/httpt.py
+++ b/ooni/templates/httpt.py
@@ -234,6 +234,10 @@ class HTTPTest(NetTestCase):
             content_length = response.headers.getRawHeaders('content-length')
         except IndexError:
             content_length = None
+        
+        if not content_length:
+            self._processResponseBody(None, request, response, None)
+            return defer.succeed(None)
 
         finished = defer.Deferred()
         response.deliverBody(BodyReceiver(finished, content_length))
@@ -322,7 +326,6 @@ class HTTPTest(NetTestCase):
 
         d = agent.request(request['method'], request['url'], headers,
                 body_producer)
-
         d.addErrback(errback, request)
         d.addCallback(self._cbResponse, request, headers_processor,
                 body_processor)





More information about the tor-commits mailing list