mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Preserve UserAgent header on redirect.
This commit is contained in:
parent
c8c7bd900d
commit
9a87f830fc
4 changed files with 44 additions and 3 deletions
|
@ -259,7 +259,9 @@ impl ResourceManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.user_agent.as_ref().map(|ua| load_data.headers.set(UserAgent(ua.clone())));
|
self.user_agent.as_ref().map(|ua| {
|
||||||
|
load_data.preserved_headers.set(UserAgent(ua.clone()));
|
||||||
|
});
|
||||||
|
|
||||||
fn from_factory(factory: fn(LoadData, LoadConsumer, Arc<MIMEClassifier>))
|
fn from_factory(factory: fn(LoadData, LoadConsumer, Arc<MIMEClassifier>))
|
||||||
-> Box<FnBox(LoadData, LoadConsumer, Arc<MIMEClassifier>) + Send> {
|
-> Box<FnBox(LoadData, LoadConsumer, Arc<MIMEClassifier>) + Send> {
|
||||||
|
|
|
@ -62,7 +62,9 @@ class ServoTestharnessExecutor(ProcessTestExecutor):
|
||||||
self.result_data = None
|
self.result_data = None
|
||||||
self.result_flag = threading.Event()
|
self.result_flag = threading.Event()
|
||||||
|
|
||||||
debug_args, command = browser_command(self.binary, ["--cpu", "--hard-fail", "-z", self.test_url(test)],
|
debug_args, command = browser_command(self.binary, ["--cpu", "--hard-fail", "-z",
|
||||||
|
"-u", "Servo/wptrunner",
|
||||||
|
self.test_url(test)],
|
||||||
self.debug_info)
|
self.debug_info)
|
||||||
|
|
||||||
self.command = command
|
self.command = command
|
||||||
|
|
|
@ -25117,7 +25117,16 @@
|
||||||
},
|
},
|
||||||
"local_changes": {
|
"local_changes": {
|
||||||
"deleted": [],
|
"deleted": [],
|
||||||
"items": {},
|
"items": {
|
||||||
|
"testharness": {
|
||||||
|
"XMLHttpRequest/preserve-ua-header-on-redirect.htm": [
|
||||||
|
{
|
||||||
|
"path": "XMLHttpRequest/preserve-ua-header-on-redirect.htm",
|
||||||
|
"url": "/XMLHttpRequest/preserve-ua-header-on-redirect.htm"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"reftest_nodes": {}
|
"reftest_nodes": {}
|
||||||
},
|
},
|
||||||
"reftest_nodes": {
|
"reftest_nodes": {
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>XMLHttpRequest: User-Agent header is preserved on redirect</title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="log"></div>
|
||||||
|
<script>
|
||||||
|
var ua = "Servo/wptrunner";
|
||||||
|
var test = async_test()
|
||||||
|
test.step(function() {
|
||||||
|
var client = new XMLHttpRequest()
|
||||||
|
client.onreadystatechange = function() {
|
||||||
|
test.step(function() {
|
||||||
|
if(client.readyState == 4) {
|
||||||
|
assert_equals(client.responseText, "user-agent,")
|
||||||
|
test.done()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
client.open("POST", "resources/redirect.py?location="+encodeURIComponent("inspect-headers.py?filter_value="+ua))
|
||||||
|
client.send(null)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue