commit 5e3bb398741fa9d9400115a41be3d69b0b0dae72 Author: Arturo Filastò art@fuffa.org Date: Wed Apr 23 15:44:49 2014 +0200
Set Content-Disposition in RandomPage HTTP Helper
Fixes: https://github.com/TheTorProject/ooni-probe/issues/305 --- oonib/oonibackend.py | 3 --- oonib/runner.py | 4 ++-- oonib/testhelpers/http_helpers.py | 3 +++ 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/oonib/oonibackend.py b/oonib/oonibackend.py index a6654b8..3e6598c 100644 --- a/oonib/oonibackend.py +++ b/oonib/oonibackend.py @@ -7,10 +7,7 @@ # In here we start all the test helpers that are required by ooniprobe and # start the report collector
-from twisted.application import internet -from twisted.internet import reactor from twisted.application import internet, service -from twisted.application.service import Application from twisted.names import dns
from cyclone import web diff --git a/oonib/runner.py b/oonib/runner.py index fb5d090..c8fafa1 100644 --- a/oonib/runner.py +++ b/oonib/runner.py @@ -20,7 +20,7 @@ from twisted.python.runtime import platformType from txtorcon import TCPHiddenServiceEndpoint, TorConfig from txtorcon import launch_tor
-from oonib.report.api import reportAPI +from oonib.report.api import reportAPI from oonib.api import ooniBackend, ooniBouncer from oonib.config import config
@@ -79,7 +79,7 @@ else: def startTor(self, torconfig): def updates(prog, tag, summary): print("%d%%: %s" % (prog, summary)) - + torconfig.SocksPort = config.main.socks_port if config.main.tor2webmode: torconfig.Tor2webMode = 1 diff --git a/oonib/testhelpers/http_helpers.py b/oonib/testhelpers/http_helpers.py index 8f09326..6c3e123 100644 --- a/oonib/testhelpers/http_helpers.py +++ b/oonib/testhelpers/http_helpers.py @@ -13,6 +13,8 @@ from cyclone.web import RequestHandler, Application from twisted.protocols import policies, basic from twisted.web.http import Request
+from oonib import randomStr + class SimpleHTTPChannel(basic.LineReceiver, policies.TimeoutMixin): """ This is a simplified version of twisted.web.http.HTTPChannel to overcome @@ -140,6 +142,7 @@ class HTTPRandomPage(HTTPTrapAll): return data
def all(self, length, keyword): + self.set_header('Content-Disposition', 'attachment; filename="%s.txt"' % randomStr(10)) length = 100 if length > 100000: length = 100000