aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--dillorc27
-rw-r--r--src/IO/http.c34
-rw-r--r--src/prefs.c8
-rw-r--r--src/prefs.h1
5 files changed, 46 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 886c20aa..1375a99f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -45,6 +45,7 @@ dillo-fltk2
- Added a workaround for a CCC reentrancy segfault.
- Bound FltkMultiLineTextResource to the html parser (TEXTAREA).
- Added code to ignore the first <P> after <LI>.
+ - Added a http_referer preference. See details in dillorc2.
Patches: Jorge Arellano Cid
+- Connected signals to <li> elements (fixes links within lists).
- Enabled text, background-color, panel_size, geometry, fullscreen,
diff --git a/dillorc2 b/dillorc2
index 2b18fb74..b87399ea 100644
--- a/dillorc2
+++ b/dillorc2
@@ -100,6 +100,13 @@ search_url="http://www.google.com/search?q=%s"
# Set the domains to access without proxy
#no_proxy = ".hola.com .mynet.cl .hi.de"
+# Set the HTTP Referer information (WARNING: affects privacy)
+# We use the same URI, not the refering page (to avoid cross-site tracking).
+# none : No referer at all (full privacy).
+# host : Default value. Send same URI's hostname (no sensible info is sent).
+# path : same URI is sent (NO PRIVACY).
+http_referer=host
+
#-------------------------------------------------------------------------
# COLORS SECTION
diff --git a/src/IO/http.c b/src/IO/http.c
index 79afc2fa..a9d11db7 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -149,11 +149,33 @@ static void Http_socket_close(SocketData_t *S)
}
/*
+ * Make the HTTP header's Referer line according to preferences
+ * (default is "host" i.e. "scheme://hostname/" )
+ */
+static char *Http_get_referer(const DilloUrl *url)
+{
+ char *referer = NULL;
+
+ if (!strcmp(prefs.http_referer, "host")) {
+ referer = dStrconcat("Referer: ", URL_SCHEME(url), "://",
+ URL_AUTHORITY(url), "/", NULL);
+ } else if (!strcmp(prefs.http_referer, "path")) {
+ referer = dStrconcat("Referer: ", URL_SCHEME(url), "://",
+ URL_AUTHORITY(url),
+ URL_PATH_(url) ? URL_PATH(url) : "/", NULL);
+ }
+ if (!referer)
+ referer = strdup("");
+ _MSG("http, referer='%s'\n", referer);
+ return referer;
+}
+
+/*
* Make the http query string
*/
char *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy)
{
- char *str, *ptr, *cookies;
+ char *str, *ptr, *cookies, *referer;
Dstr *s_port = dStr_new(""),
*query = dStr_new(""),
*full_path = dStr_new(""),
@@ -181,6 +203,7 @@ char *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy)
}
cookies = a_Cookies_get(url);
+ referer = Http_get_referer(url);
if (URL_FLAGS(url) & URL_Post) {
dStr_sprintfa(
query,
@@ -188,6 +211,7 @@ char *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy)
"Accept-Charset: utf-8, iso-8859-1\r\n"
"Host: %s%s\r\n"
"%s"
+ "%s"
"User-Agent: Dillo/%s\r\n"
"Accept-Encoding: gzip\r\n"
"Cookie2: $Version=\"1\"\r\n"
@@ -198,7 +222,7 @@ char *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy)
"\r\n"
"%s",
full_path->str, URL_HOST(url), s_port->str,
- proxy_auth->str, VERSION, cookies,
+ proxy_auth->str, referer, VERSION, cookies,
(long)strlen(URL_DATA(url)),
URL_DATA(url));
@@ -210,6 +234,7 @@ char *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy)
"Accept-Charset: utf-8, iso-8859-1\r\n"
"Host: %s%s\r\n"
"%s"
+ "%s"
"User-Agent: Dillo/%s\r\n"
"Accept-Encoding: gzip\r\n"
"Cookie2: $Version=\"1\"\r\n"
@@ -220,10 +245,9 @@ char *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy)
(URL_FLAGS(url) & URL_E2EReload) ?
"Cache-Control: no-cache\r\nPragma: no-cache\r\n" : "",
URL_HOST(url), s_port->str,
- proxy_auth->str,
- VERSION,
- cookies);
+ proxy_auth->str, referer, VERSION, cookies);
}
+ dFree(referer);
dFree(cookies);
str = query->str;
diff --git a/src/prefs.c b/src/prefs.c
index f174e156..30d10642 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -80,6 +80,7 @@ typedef enum {
DRC_TOKEN_PANEL_SIZE,
DRC_TOKEN_PROXY,
DRC_TOKEN_PROXYUSER,
+ DRC_TOKEN_REFERER,
DRC_TOKEN_SAVE_DIR,
DRC_TOKEN_SEARCH_URL,
DRC_TOKEN_SHOW_BACK,
@@ -134,6 +135,7 @@ static const SymNode_t symbols[] = {
{ "home", DRC_TOKEN_HOME },
{ "http_proxy", DRC_TOKEN_PROXY },
{ "http_proxyuser", DRC_TOKEN_PROXYUSER },
+ { "http_referer", DRC_TOKEN_REFERER },
{ "limit_text_width", DRC_TOKEN_LIMIT_TEXT_WIDTH },
{ "link_color", DRC_TOKEN_LINK_COLOR },
{ "load_images", DRC_TOKEN_LOAD_IMAGES },
@@ -210,6 +212,10 @@ static int Prefs_parse_pair(char *name, char *value)
dFree(prefs.http_proxyuser);
prefs.http_proxyuser = dStrdup(value);
break;
+ case DRC_TOKEN_REFERER:
+ dFree(prefs.http_referer);
+ prefs.http_referer = dStrdup(value);
+ break;
case DRC_TOKEN_NOPROXY:
dFree(prefs.no_proxy);
prefs.no_proxy = dStrdup(value);
@@ -406,6 +412,7 @@ void a_Prefs_init(void)
prefs.ypos = D_GEOMETRY_DEFAULT_YPOS;
prefs.http_proxy = NULL;
prefs.http_proxyuser = NULL;
+ prefs.http_referer = strdup("host");
prefs.no_proxy = NULL;
prefs.link_color = DW_COLOR_DEFAULT_BLUE;
prefs.visited_color = DW_COLOR_DEFAULT_PURPLE;
@@ -466,6 +473,7 @@ void a_Prefs_init(void)
void a_Prefs_freeall(void)
{
dFree(prefs.http_proxyuser);
+ dFree(prefs.http_referer);
dFree(prefs.no_proxy);
a_Url_free(prefs.http_proxy);
dFree(prefs.fw_fontname);
diff --git a/src/prefs.h b/src/prefs.h
index cab3a914..f5a5f35c 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -19,6 +19,7 @@ struct _DilloPrefs {
int ypos;
DilloUrl *http_proxy;
char *http_proxyuser;
+ char *http_referer;
char *no_proxy;
DilloUrl *start_page;
DilloUrl *home;