gecko-dev/testing/web-platform/tests/fetch/http-cache/resources/securedimage.py
Philip Jägenstedt ceba72f036 Bug 1459608 [wpt PR 10870] - Move http/ tests into fetch/ and html/, a=testonly
Automatic update from web-platform-testsMove http/ tests into fetch/ and html/ (#10870)

As discussed in https://github.com/w3c/web-platform-tests/pull/10839.
--

wpt-commits: e1fb329f9cddd385706f78ecba642c84c6936c9f
wpt-pr: 10870


--HG--
rename : testing/web-platform/tests/http/content_length.html => testing/web-platform/tests/fetch/content-length/content-length.html
rename : testing/web-platform/tests/http/content_length.html.headers => testing/web-platform/tests/fetch/content-length/content-length.html.headers
rename : testing/web-platform/tests/http/basic-auth-cache-test-ref.html => testing/web-platform/tests/fetch/http-cache/basic-auth-cache-test-ref.html
rename : testing/web-platform/tests/http/refresh/navigate.window.js => testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/refresh/navigate.window.js
rename : testing/web-platform/tests/http/refresh/resources/multiple.asis => testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/refresh/resources/multiple.asis
rename : testing/web-platform/tests/http/refresh/resources/refresh.py => testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/refresh/resources/refresh.py
rename : testing/web-platform/tests/http/refresh/resources/refreshed.txt => testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/refresh/resources/refreshed.txt
rename : testing/web-platform/tests/http/refresh/subresource.any.js => testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/refresh/subresource.any.js
2018-05-14 09:55:23 +00:00

17 lines
597 B
Python

# -*- coding: utf-8 -
def main(request, response):
image_url = str.replace(request.url, "fetch/http-cache/resources/securedimage.py", "images/green.png")
if "authorization" not in request.headers:
response.status = 401
response.headers.set("WWW-Authenticate", "Basic")
return
else:
auth = request.headers.get("Authorization")
if auth != "Basic dGVzdHVzZXI6dGVzdHBhc3M=":
response.set_error(403, "Invalid username or password - " + auth)
return
response.status = 301
response.headers.set("Location", image_url)