mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
don't unconditionally override header
This commit is contained in:
parent
7c3a8d3f5b
commit
3a949b77b2
3 changed files with 10 additions and 11 deletions
|
@ -523,7 +523,16 @@ pub fn modify_request_headers(headers: &mut Headers,
|
||||||
port: doc_url.port_or_default()
|
port: doc_url.port_or_default()
|
||||||
};
|
};
|
||||||
headers.set(host);
|
headers.set(host);
|
||||||
headers.set(UserAgent(user_agent.to_owned()));
|
|
||||||
|
// If the user-agent has not already been set, then use the
|
||||||
|
// browser's default user-agent or the user-agent override
|
||||||
|
// from the command line. If the user-agent is set, don't
|
||||||
|
// modify it, as setting of the user-agent by the user is
|
||||||
|
// allowed.
|
||||||
|
// https://fetch.spec.whatwg.org/#concept-http-network-or-cache-fetch step 8
|
||||||
|
if !headers.has::<UserAgent>() {
|
||||||
|
headers.set(UserAgent(user_agent.to_owned()));
|
||||||
|
}
|
||||||
|
|
||||||
set_default_accept(headers);
|
set_default_accept(headers);
|
||||||
set_default_accept_encoding(headers);
|
set_default_accept_encoding(headers);
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[preserve-ua-header-on-redirect.htm]
|
|
||||||
type: testharness
|
|
||||||
[XMLHttpRequest: User-Agent header is preserved on redirect 1]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[setrequestheader-header-allowed.htm]
|
|
||||||
type: testharness
|
|
||||||
[XMLHttpRequest: setRequestHeader() - headers that are allowed (User-Agent)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue