summaryrefslogtreecommitdiff
path: root/netwerk
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-10-07 21:38:26 +0000
committerMoonchild <moonchild@palemoon.org>2022-04-01 14:41:51 +0200
commitc030a50228349fa1b2c0b4fbc2e83752324dd4d7 (patch)
tree7102015febc58021d3e6af6ac40b3299e437f1d2 /netwerk
parente4c6db86b806a9b7b11b94323189954736d45a67 (diff)
downloaduxp-c030a50228349fa1b2c0b4fbc2e83752324dd4d7.tar.gz
Issue #1721 - Implement GlobalPrivacyControl
(and get rid of failed DoNotTrack)
Diffstat (limited to 'netwerk')
-rw-r--r--netwerk/protocol/http/nsHttpAtomList.h2
-rw-r--r--netwerk/protocol/http/nsHttpChannel.cpp15
-rw-r--r--netwerk/protocol/http/nsHttpChannel.h2
-rw-r--r--netwerk/protocol/http/nsHttpHandler.cpp22
-rw-r--r--netwerk/protocol/http/nsHttpHandler.h4
5 files changed, 20 insertions, 25 deletions
diff --git a/netwerk/protocol/http/nsHttpAtomList.h b/netwerk/protocol/http/nsHttpAtomList.h
index 5db985613e..867ac0010d 100644
--- a/netwerk/protocol/http/nsHttpAtomList.h
+++ b/netwerk/protocol/http/nsHttpAtomList.h
@@ -45,11 +45,11 @@ HTTP_ATOM(Date, "Date")
HTTP_ATOM(DAV, "DAV")
HTTP_ATOM(Depth, "Depth")
HTTP_ATOM(Destination, "Destination")
-HTTP_ATOM(DoNotTrack, "DNT")
HTTP_ATOM(ETag, "Etag")
HTTP_ATOM(Expect, "Expect")
HTTP_ATOM(Expires, "Expires")
HTTP_ATOM(From, "From")
+HTTP_ATOM(GlobalPrivacyControl, "Sec-GPC")
HTTP_ATOM(Host, "Host")
HTTP_ATOM(If, "If")
HTTP_ATOM(If_Match, "If-Match")
diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp
index 464f7507d8..3ba812b923 100644
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -5711,7 +5711,7 @@ nsHttpChannel::BeginConnect()
mRequestHead.SetHTTPS(isHttps);
mRequestHead.SetOrigin(scheme, host, port);
- SetDoNotTrack();
+ SetGPC();
NeckoOriginAttributes originAttributes;
NS_GetOriginAttributes(this, originAttributes);
@@ -8035,18 +8035,13 @@ nsHttpChannel::ResumeInternal()
}
void
-nsHttpChannel::SetDoNotTrack()
+nsHttpChannel::SetGPC()
{
/**
- * 'DoNotTrack' header should be added if 'privacy.donottrackheader.enabled'
- * is true or tracking protection is enabled. See bug 1258033.
+ * 'Sec-GPC: 1' header should be added if 'privacy.GPCheader.enabled' is true.
*/
- nsCOMPtr<nsILoadContext> loadContext;
- NS_QueryNotificationCallbacks(this, loadContext);
-
- if ((loadContext && loadContext->UseTrackingProtection()) ||
- nsContentUtils::DoNotTrackEnabled()) {
- mRequestHead.SetHeader(nsHttp::DoNotTrack,
+ if (nsContentUtils::GPCEnabled()) {
+ mRequestHead.SetHeader(nsHttp::GlobalPrivacyControl,
NS_LITERAL_CSTRING("1"),
false);
}
diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h
index b7f39b2f09..76cffe8670 100644
--- a/netwerk/protocol/http/nsHttpChannel.h
+++ b/netwerk/protocol/http/nsHttpChannel.h
@@ -453,7 +453,7 @@ private:
void SetPushedStream(Http2PushedStreamWrapper *stream);
- void SetDoNotTrack();
+ void SetGPC();
private:
nsCOMPtr<nsICancelable> mProxyRequest;
diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
index 42c7b1a8fe..81b8a9f550 100644
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -89,12 +89,12 @@
#define HTTP_PREF_PREFIX "network.http."
#define INTL_ACCEPT_LANGUAGES "intl.accept_languages"
#define BROWSER_PREF_PREFIX "browser.cache."
-#define DONOTTRACK_HEADER_ENABLED "privacy.donottrackheader.enabled"
-#define H2MANDATORY_SUITE "security.ssl3.ecdhe_rsa_aes_128_gcm_sha256"
-#define ALLOW_EXPERIMENTS "network.allow-experiments"
-#define SAFE_HINT_HEADER_VALUE "safeHint.enabled"
-#define SECURITY_PREFIX "security."
-#define NEW_TAB_REMOTE_MODE "browser.newtabpage.remote.mode"
+#define GPC_HEADER_ENABLED "privacy.GPCheader.enabled"
+#define H2MANDATORY_SUITE "security.ssl3.ecdhe_rsa_aes_128_gcm_sha256"
+#define ALLOW_EXPERIMENTS "network.allow-experiments"
+#define SAFE_HINT_HEADER_VALUE "safeHint.enabled"
+#define SECURITY_PREFIX "security."
+#define NEW_TAB_REMOTE_MODE "browser.newtabpage.remote.mode"
#define GUA_PREF(_pref) GENERAL_UA_PREF_PREFIX _pref
#define UA_PREF(_pref) HTTP_PREF_PREFIX UA_PREF_PREFIX _pref
@@ -184,7 +184,7 @@ nsHttpHandler::nsHttpHandler()
, mAcceptLanguagesIsDirty(true)
, mPromptTempRedirect(true)
, mEnablePersistentHttpsCaching(false)
- , mDoNotTrackEnabled(false)
+ , mGPCEnabled(false)
, mSafeHintEnabled(false)
, mParentalControlEnabled(false)
, mHandlerActive(false)
@@ -282,7 +282,7 @@ nsHttpHandler::Init()
prefBranch->AddObserver(GENERAL_UA_PREF_PREFIX, this, true);
prefBranch->AddObserver(INTL_ACCEPT_LANGUAGES, this, true);
prefBranch->AddObserver(BROWSER_PREF("disk_cache_ssl"), this, true);
- prefBranch->AddObserver(DONOTTRACK_HEADER_ENABLED, this, true);
+ prefBranch->AddObserver(GPC_HEADER_ENABLED, this, true);
prefBranch->AddObserver(H2MANDATORY_SUITE, this, true);
prefBranch->AddObserver(HTTP_PREF("tcp_keepalive.short_lived_connections"), this, true);
prefBranch->AddObserver(HTTP_PREF("tcp_keepalive.long_lived_connections"), this, true);
@@ -1500,11 +1500,11 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
// Tracking options
//
- if (PREF_CHANGED(DONOTTRACK_HEADER_ENABLED)) {
+ if (PREF_CHANGED(GPC_HEADER_ENABLED)) {
cVar = false;
- rv = prefs->GetBoolPref(DONOTTRACK_HEADER_ENABLED, &cVar);
+ rv = prefs->GetBoolPref(GPC_HEADER_ENABLED, &cVar);
if (NS_SUCCEEDED(rv)) {
- mDoNotTrackEnabled = cVar;
+ mGPCEnabled = cVar;
}
}
// Hint option
diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h
index c3f6290095..caeabf81de 100644
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -515,8 +515,8 @@ private:
// Persistent HTTPS caching flag
bool mEnablePersistentHttpsCaching;
- // For broadcasting tracking preference
- bool mDoNotTrackEnabled;
+ // For broadcasting Global Privacy Control preference
+ bool mGPCEnabled;
// for broadcasting safe hint;
bool mSafeHintEnabled;