Revision 9936e8c644dfcfc1c02ba53fa26c501d64eccc11 authored by Yutaka Hirano on 21 November 2017, 10:42:44 UTC, committed by Chromium WPT Sync on 21 November 2017, 10:42:44 UTC
This CL introduces a mime type parser and stringifier to wpt/XMLHttpRequest/send-content-type-charset in order to accept implementations that are actually conforming to the spec but were rejected by the test due to some text representation errors. Bug: https://github.com/whatwg/mimesniff/issues/39 Change-Id: I99466e2e596bb9c1b7f11267ad4ff0a886913086
1 parent 93f495e
report.py
import time
import json
import re
def main(request, response):
op = request.GET.first("op");
key = request.GET.first("reportID")
if op == "take":
timeout = float(request.GET.first("timeout"))
t0 = time.time()
while time.time() - t0 < timeout:
time.sleep(0.5)
value = request.server.stash.take(key=key)
if value is not None:
return [("Content-Type", "application/json")], value
return [("Content-Type", "application/json")], json.dumps({'error': 'No such report.' , 'guid' : key})
if op == "cookies":
cval = request.server.stash.take(key=re.sub('^...', 'ccc', key))
if cval is None:
cval = "\"None\""
return [("Content-Type", "application/json")], "{ \"reportCookies\" : " + cval + "}"
if hasattr(request, 'Cookies'):
request.server.stash.put(key=re.sub('^...', 'ccc', key), value=request.Cookies)
report = request.body
report.rstrip()
request.server.stash.take(key=key)
request.server.stash.put(key=key, value=report)
return [("Content-Type", "text/plain")], "Recorded report " + report
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...