summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/infrastructure/urls/resolving-urls/query-encoding/resources/stash.py
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/infrastructure/urls/resolving-urls/query-encoding/resources/stash.py')
-rw-r--r--testing/web-platform/tests/html/infrastructure/urls/resolving-urls/query-encoding/resources/stash.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/infrastructure/urls/resolving-urls/query-encoding/resources/stash.py b/testing/web-platform/tests/html/infrastructure/urls/resolving-urls/query-encoding/resources/stash.py
new file mode 100644
index 0000000000..a6b589d2ac
--- /dev/null
+++ b/testing/web-platform/tests/html/infrastructure/urls/resolving-urls/query-encoding/resources/stash.py
@@ -0,0 +1,15 @@
+import re
+
+def main(request, response):
+ key = request.GET[b'id']
+ action = request.GET[b'action']
+ if action == b'put':
+ # We want the raw input for 'q'
+ q = re.search(r'q=([^&]+)', request.url_parts.query).groups()[0]
+ request.server.stash.put(key, q)
+ return [(b"Content-Type", b"text/html")], u'Put %s' % q
+ else:
+ q = request.server.stash.take(key)
+ if q != None:
+ return [(b"Content-Type", b"text/html")], q
+ return [], u""