[PATCH] Add user-controllable Sec-GPC header
<[email protected]> Wed, 15 Apr 2026 17:46:05 +0000
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <[email protected]> |
--MP_/M5MC9abmQ9nDYG/VI=LgMZ0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, The attached patch adds a Sec-GPC header to Dillo. It defaults to ON, and is controllable through a dillorc setting of 'http_sec_gpc'. Also, I changed DNT to be user-controllable with a dillorc setting of 'http_dnt', also defaults to ON. I know that this is too late to get in for the 3.3.0 release, but I'm sending it for review now, and if there are any issues it should allow plenty of time to fix. Regards, Alex --MP_/M5MC9abmQ9nDYG/VI=LgMZ0 Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-Add-user-controllable-Sec-GPC-header.patch >From ae3d645863e4fc5c8269cea69b91c0772f74ea42 Mon Sep 17 00:00:00 2001 From: Alex <[email protected]> Date: Wed, 15 Apr 2026 17:25:20 +0000 Subject: [PATCH] Add user-controllable Sec-GPC header Sec-GPC is an HTTP header which indicates that the user does not want to be tracked. This can be turned on or off with a dillorc option of 'http_sec_gpc' (default is ON). Also add an option to control the existing DNT (Do Not Track) header (which remains ON by default): 'http_dnt'. --- dillorc | 6 ++++++ src/IO/http.c | 12 ++++++++---- src/prefs.c | 2 ++ src/prefs.h | 2 ++ src/prefsparser.cc | 2 ++ 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/dillorc b/dillorc index 15c229bd..c3379e26 100644 --- a/dillorc +++ b/dillorc @@ -294,6 +294,12 @@ search_url="mj Mojeek https://www.mojeek.com/search?q=%s" # http_user_agent="Wget/1.13.4 (linux-gnu)" #The default is "Dillo/"+current_version_number +# Send DNT (Do Not Track) header +#http_dnt=YES + +# Send Sec-GPC (Global Privacy Control) header +#http_sec_gpc=YES + #------------------------------------------------------------------------- # COLORS SECTION #------------------------------------------------------------------------- diff --git a/src/IO/http.c b/src/IO/http.c index 6c11c9f7..09d40620 100644 --- a/src/IO/http.c +++ b/src/IO/http.c @@ -416,6 +416,12 @@ static Dstr *Http_make_query_str(DilloWeb *web, bool_t use_proxy, bool_t use_tls cookies = a_Cookies_get_query(url, web->requester, web->flags & WEB_RootUrl); auth = a_Auth_get_auth_str(url, request_uri->str); referer = Http_get_referer(url); + char *http_dnt = dStrdup(""); + if (prefs.http_dnt) + http_dnt = dStrdup("DNT: 1\r\n"); + char *http_sec_gpc = dStrdup(""); + if (prefs.http_sec_gpc) + http_sec_gpc = dStrdup("Sec-GPC: 1\r\n"); if (URL_FLAGS(url) & URL_Post) { Dstr *content_type = Http_make_content_type(url); dStr_sprintfa( @@ -431,7 +437,6 @@ static Dstr *Http_make_query_str(DilloWeb *web, bool_t use_proxy, bool_t use_tls #endif "\r\n" "%s" /* auth */ - "DNT: 1\r\n" "%s" /* proxy auth */ "%s" /* referer */ "Connection: %s\r\n" @@ -442,7 +447,7 @@ static Dstr *Http_make_query_str(DilloWeb *web, bool_t use_proxy, bool_t use_tls request_uri->str, URL_AUTHORITY(url), prefs.http_user_agent, accept_hdr_value, HTTP_Language_hdr, auth ? auth : "", proxy_auth->str, referer, connection_hdr_val, content_type->str, - (long)URL_DATA(url)->len, cookies); + http_dnt, http_sec_gpc, (long)URL_DATA(url)->len, cookies); dStr_append_l(query, URL_DATA(url)->str, URL_DATA(url)->len); dStr_free(content_type, TRUE); } else { @@ -459,7 +464,6 @@ static Dstr *Http_make_query_str(DilloWeb *web, bool_t use_proxy, bool_t use_tls #endif "\r\n" "%s" /* auth */ - "DNT: 1\r\n" "%s" /* proxy auth */ "%s" /* referer */ "Connection: %s\r\n" @@ -468,7 +472,7 @@ static Dstr *Http_make_query_str(DilloWeb *web, bool_t use_proxy, bool_t use_tls "\r\n", request_uri->str, URL_AUTHORITY(url), prefs.http_user_agent, accept_hdr_value, HTTP_Language_hdr, auth ? auth : "", - proxy_auth->str, referer, connection_hdr_val, + proxy_auth->str, referer, connection_hdr_val, http_dnt, http_sec_gpc, (URL_FLAGS(url) & URL_E2EQuery) ? "Pragma: no-cache\r\nCache-Control: no-cache\r\n" : "", cookies); diff --git a/src/prefs.c b/src/prefs.c index 4741ef30..20129e97 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -72,6 +72,8 @@ void a_Prefs_init(void) prefs.http_strict_transport_security = TRUE; prefs.http_force_https = FALSE; prefs.http_user_agent = dStrdup(PREFS_HTTP_USER_AGENT); + prefs.http_dnt = TRUE; + prefs.http_sec_gpc = TRUE; prefs.limit_text_width = FALSE; prefs.adjust_min_width = TRUE; prefs.adjust_table_min_width = TRUE; diff --git a/src/prefs.h b/src/prefs.h index 7b7ab869..4cff03f1 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -105,6 +105,8 @@ typedef struct { bool_t http_persistent_conns; bool_t http_strict_transport_security; bool_t http_force_https; + bool_t http_dnt; + bool_t http_sec_gpc; int32_t buffered_drawing; char *font_serif; char *font_sans_serif; diff --git a/src/prefsparser.cc b/src/prefsparser.cc index ddc5f173..b67c9783 100644 --- a/src/prefsparser.cc +++ b/src/prefsparser.cc @@ -181,6 +181,8 @@ void PrefsParser::parse(FILE *fp) PREFS_BOOL, 0 }, { "http_force_https", &prefs.http_force_https, PREFS_BOOL, 0 }, { "http_user_agent", &prefs.http_user_agent, PREFS_STRING, 0 }, + { "http_dnt", &prefs.http_dnt, PREFS_BOOL, 0 }, + { "http_sec_gpc", &prefs.http_sec_gpc, PREFS_BOOL, 0 }, { "limit_text_width", &prefs.limit_text_width, PREFS_BOOL, 0 }, { "adjust_min_width", &prefs.adjust_min_width, PREFS_BOOL, 0 }, { "adjust_table_min_width", &prefs.adjust_table_min_width, PREFS_BOOL, 0 }, -- 2.51.0 --MP_/M5MC9abmQ9nDYG/VI=LgMZ0 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Dillo-dev mailing list -- dillo-dev-lx9mn2B4QYRWk0Htik3J/[email protected] To unsubscribe send an email to dillo-dev-leave-lx9mn2B4QYRWk0Htik3J/[email protected] --MP_/M5MC9abmQ9nDYG/VI=LgMZ0--