[epiphany] Revert "Remove support for do-not-track headers"



commit aebe8ffb4d9a1f80d411da8778fea95a22cf25aa
Author: Michael Catanzaro <mcatanzaro posteo net>
Date:   Tue Feb 5 17:43:49 2019 +0000

    Revert "Remove support for do-not-track headers"
    
    This reverts commit f3f42ef44171728d8e1d2205f9b0e58177785b53

 data/org.gnome.epiphany.gschema.xml      |  2 +-
 embed/web-extension/ephy-web-extension.c | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index cc4a2f381..c49207002 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -177,7 +177,7 @@
                <key type="b" name="do-not-track">
                        <default>true</default>
                        <summary>Do Not Track</summary>
-                       <description>Enables tracking query parameter removal. Note that when changing this 
setting from the preferences dialog, the adblock-filters setting will additionally be updated to add/remove 
EasyPrivacy filters.</description>
+                       <description>Enables DNT headers and tracking query parameter removal. Note that when 
changing this setting from the preferences dialog, the adblock-filters setting will additionally be updated 
to add/remove EasyPrivacy filters.</description>
                </key>
                <key type="b" name="enable-adblock">
                        <default>true</default>
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index 45f13e683..f059c207b 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -151,6 +151,16 @@ web_page_send_request (WebKitWebPage     *web_page,
   page_uri = webkit_web_page_get_uri (web_page);
   redirected_response_uri = redirected_response ? webkit_uri_response_get_uri (redirected_response) : NULL;
 
+  if (g_settings_get_boolean (EPHY_SETTINGS_WEB_EXTENSION_WEB, EPHY_PREFS_WEB_DO_NOT_TRACK)) {
+    SoupMessageHeaders *headers = webkit_uri_request_get_http_headers (request);
+    if (headers) {
+      /* Do Not Track header. '1' means 'opt-out'. See:
+       * http://tools.ietf.org/id/draft-mayer-do-not-track-00.txt */
+      soup_message_headers_append (headers, "DNT", "1");
+    }
+    modified_uri = ephy_remove_tracking_from_uri (request_uri);
+  }
+
   if (should_use_adblocker (request_uri, page_uri, redirected_response_uri)) {
     char *result;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]