Revision 149c83d77d05dafea4a5a4dadf6670bfadc8e360 authored by moz-wptsync-bot on 16 March 2018, 13:38:52 UTC, committed by moz-wptsync-bot on 16 March 2018, 13:38:52 UTC
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1445883 gecko-commit: 0f81334efa0a008db8931a41eef2d26a77d0e800 gecko-integration-branch: mozilla-inbound gecko-reviewers: smaug
1 parent 1cbb928
inspect-headers.py
def get_response(raw_headers, filter_value, filter_name):
result = ""
for line in raw_headers.headers:
if line[-2:] != '\r\n':
return "Syntax error: missing CRLF: " + line
line = line[:-2]
if ':' not in line:
return "Syntax error: no colon found: " + line
name, value = line.split(':', 1)
if len(value) > 1 and value[0] == ' ':
value = value[1:]
if filter_value:
if value == filter_value:
result += name + ","
elif name.lower() == filter_name:
result += name + ": " + value + "\n";
return result
def main(request, response):
headers = []
if "cors" in request.GET:
headers.append(("Access-Control-Allow-Origin", "*"))
headers.append(("Access-Control-Allow-Credentials", "true"))
headers.append(("Access-Control-Allow-Methods", "GET, POST, PUT, FOO"))
headers.append(("Access-Control-Allow-Headers", "x-test, x-foo"))
headers.append(("Access-Control-Expose-Headers", "x-request-method, x-request-content-type, x-request-query, x-request-content-length"))
headers.append(("content-type", "text/plain"))
filter_value = request.GET.first("filter_value", "")
filter_name = request.GET.first("filter_name", "").lower()
result = get_response(request.raw_headers, filter_value, filter_name)
return headers, result
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...