mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
added test that verifies proper basic auth caching behavior
This commit is contained in:
parent
0bcd04d2ab
commit
712b1d5ea0
5 changed files with 66 additions and 1 deletions
|
@ -37486,9 +37486,36 @@
|
|||
"url": "/dom/lists/DOMTokenList-Iterable.html"
|
||||
}
|
||||
]
|
||||
},
|
||||
"reftest": {
|
||||
"http/basic-auth-cache-test.html": [
|
||||
{
|
||||
"path": "http/basic-auth-cache-test.html",
|
||||
"references": [
|
||||
[
|
||||
"/http/basic-auth-cache-test-ref.html",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
"url": "/http/basic-auth-cache-test.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"reftest_nodes": {}
|
||||
"reftest_nodes": {
|
||||
"http/reftest-basic-auth-cache-test.html": [
|
||||
{
|
||||
"path": "http/basic-auth-cache-test.html",
|
||||
"references": [
|
||||
[
|
||||
"/http/basic-auth-cache-test-ref.html",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
"url": "/http/basic-auth-cache-test.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"reftest_nodes": {
|
||||
"2dcontext/building-paths/canvas_complexshapes_arcto_001.htm": [
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<html>
|
||||
<img src="resources/image.png">
|
||||
<img src="resources/image.png">
|
||||
</html>
|
15
tests/wpt/web-platform-tests/http/basic-auth-cache-test.html
Normal file
15
tests/wpt/web-platform-tests/http/basic-auth-cache-test.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<link rel="match" href="basic-auth-cache-test-ref.html">
|
||||
<html>
|
||||
<div id="auth"> </div>
|
||||
<div id="noauth"> </div>
|
||||
<script type="text/javascript">
|
||||
var authImg = '<img src="http://testuser:testpass@' + window.location.host + '/http/resources/securedimage.py">';
|
||||
document.getElementById('auth').innerHTML = authImg;
|
||||
setTimeout(function() {
|
||||
var noAuthImg = '<img src="http://' + window.location.host + '/http/resources/securedimage.py">';
|
||||
document.getElementById('noauth').innerHTML = noAuthImg;
|
||||
}, 100);
|
||||
</script>
|
||||
</html>
|
BIN
tests/wpt/web-platform-tests/http/resources/image.png
Normal file
BIN
tests/wpt/web-platform-tests/http/resources/image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
17
tests/wpt/web-platform-tests/http/resources/securedimage.py
Normal file
17
tests/wpt/web-platform-tests/http/resources/securedimage.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -
|
||||
|
||||
def main(request, response):
|
||||
image_url = str.replace(request.url, "securedimage.py", "image.png")
|
||||
|
||||
if "authorization" not in request.headers:
|
||||
response.status = 401
|
||||
response.headers.set("WWW-Authenticate", "Basic")
|
||||
return response
|
||||
else:
|
||||
auth = request.headers.get("Authorization")
|
||||
if auth != "Basic dGVzdHVzZXI6dGVzdHBhc3M=":
|
||||
response.set_error(403, "Invalid username or password - " + auth)
|
||||
return response
|
||||
|
||||
response.status = 301
|
||||
response.headers.set("Location", image_url)
|
Loading…
Add table
Add a link
Reference in a new issue