Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/support/report.py

Issue 2695813009: Import wpt@503f5b5f78ec4e87d144f78609f363f0ed0ea8db (Closed)
Patch Set: Skip some tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 import time
2 import json
3 import re
4
5 def main(request, response):
6 op = request.GET.first("op");
7 key = request.GET.first("reportID")
8
9 if op == "take":
10 timeout = float(request.GET.first("timeout"))
11 t0 = time.time()
12 while time.time() - t0 < timeout:
13 time.sleep(0.5)
14 value = request.server.stash.take(key=key)
15 if value is not None:
16 return [("Content-Type", "application/json")], value
17
18 return [("Content-Type", "application/json")], json.dumps({'error': 'No such report.' , 'guid' : key})
19
20 if op == "cookies":
21 cval = request.server.stash.take(key=re.sub('^...', 'ccc', key))
22 if cval is None:
23 cval = "\"None\""
24
25 return [("Content-Type", "application/json")], "{ \"reportCookies\" : " + cval + "}"
26
27 if hasattr(request, 'Cookies'):
28 request.server.stash.put(key=re.sub('^...', 'ccc', key), value=request.C ookies)
29
30 report = request.body
31 report.rstrip()
32 request.server.stash.take(key=key)
33 request.server.stash.put(key=key, value=report)
34 return [("Content-Type", "text/plain")], "Recorded report " + report
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698