Bug 1543201 - DoH Privacy Enhancement: Do not set the User-Agent header for DoH requests r=dragana

Differential Revision: https://phabricator.services.mozilla.com/D55934

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Valentin Gosu 2019-12-05 19:17:28 +00:00
parent bf24d1cca9
commit 7f4d9c85c8
3 changed files with 14 additions and 1 deletions

View File

@ -6909,6 +6909,12 @@
value: false
mirror: always
# Whether to send the User-Agent header for TRR requests
- name: network.trr.send_user-agent_headers
type: bool
value: false
mirror: always
# This pref controls if TRR will still be enabled when a VPN is detected on
# the system. Detection is not foolproof, and some VPNs may not be detected.
# See bug 1565004 comment 3 for details.

View File

@ -313,6 +313,13 @@ nsresult TRR::SendHTTPRequest() {
NS_ENSURE_SUCCESS(rv, rv);
}
// Sanitize the request by removing the User-Agent
if (!StaticPrefs::network_trr_send_user_agent_headers()) {
rv = httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("User-Agent"),
EmptyCString(), false);
NS_ENSURE_SUCCESS(rv, rv);
}
// set the *default* response content type
if (NS_FAILED(httpChannel->SetContentType(
NS_LITERAL_CSTRING("application/dns-message")))) {

View File

@ -673,7 +673,7 @@ function handleRequest(req, res) {
});
}
if (req.headers["accept-language"]) {
if (req.headers["accept-language"] || req.headers["user-agent"]) {
// If we get this header, don't send back any response. This should
// cause the tests to fail. This is easier then actually sending back
// the header value into test_trr.js