diff options
Diffstat (limited to 'test/world_wide_library.py')
-rw-r--r-- | test/world_wide_library.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/world_wide_library.py b/test/world_wide_library.py index bed6ec3..14e3d2f 100644 --- a/test/world_wide_library.py +++ b/test/world_wide_library.py @@ -31,6 +31,7 @@ from hashlib import sha256 from pathlib import Path from shutil import rmtree from threading import Lock +import json from .misc_constants import here @@ -87,6 +88,18 @@ def dump_scripts(directory='./injected_scripts'): some_data = '{"some": "data"}' +# used by handler function of https://counterdoma.in +request_counter = 0 + +def serve_counter(command, get_params, post_params): + global request_counter + request_counter += 1 + return ( + 200, + {'Cache-Control': 'private, max-age=0, no-store'}, + json.dumps({'counter': request_counter}) + ) + catalog = { 'http://gotmyowndoma.in': (302, {'location': 'http://gotmyowndoma.in/index.html'}, None), @@ -108,6 +121,8 @@ catalog = { 'https://anotherdoma.in/resource/blocked/by/CORS.json': lambda command, get_params, post_params: (200, {}, some_data), + 'https://counterdoma.in/': serve_counter, + 'https://serve.scrip.ts/': serve_script, 'https://site.with.scripts.block.ed': |