katze_preferences_add_widget (preferences, button, "indented");
#endif
#endif
- katze_preferences_add_group (preferences, _("History"));
+ #if HAVE_LIBSOUP_2_27_90
+ button = katze_property_proxy (settings, "strip-referer", NULL);
+ katze_preferences_add_widget (preferences, button, "indented");
+ #endif
button = katze_property_label (settings, "maximum-history-age");
katze_preferences_add_widget (preferences, button, "indented");
button = katze_property_proxy (settings, "maximum-history-age", NULL);
g_free (languages);
soup_message_headers_append (msg->request_headers, "Accept-Language", accpt);
g_free (accpt);
+
+ #if HAVE_LIBSOUP_2_27_90
+ if (katze_object_get_boolean (settings, "strip-referer"))
+ {
+ const gchar* referer
+ = soup_message_headers_get_one (msg->request_headers, "Referer");
+ SoupURI* destination = soup_message_get_uri (msg);
+ if (referer && destination && !strstr (referer, destination->host))
+ {
+ SoupURI* stripped_uri = soup_uri_new (referer);
+ gchar* stripped_referer;
+ soup_uri_set_path (stripped_uri, NULL);
+ soup_uri_set_query (stripped_uri, NULL);
+ stripped_referer = soup_uri_to_string (stripped_uri, FALSE);
+ soup_uri_free (stripped_uri);
+ g_message ("Referer stripped");
+ soup_message_headers_replace (msg->request_headers, "Referer",
+ stripped_referer);
+ g_free (stripped_referer);
+ }
+ }
+ #endif
}
static void
#if WEBKIT_CHECK_VERSION (1, 3, 13)
g_object_set (settings, "enable-dns-prefetching", FALSE, NULL);
#endif
+ g_object_set (settings, "strip-referer", TRUE, NULL);
midori_browser_set_action_visible (browser, "Tools", FALSE);
midori_browser_set_action_visible (browser, "ClearPrivateData", FALSE);
}
gint clear_private_data;
gchar* clear_data;
+ gboolean strip_referer;
};
struct _MidoriWebSettingsClass
PROP_PREFERRED_LANGUAGES,
PROP_CLEAR_PRIVATE_DATA,
- PROP_CLEAR_DATA
+ PROP_CLEAR_DATA,
+ PROP_STRIP_REFERER
};
GType
_("The data selected for deletion"),
NULL,
flags));
+ /**
+ * MidoriWebSettings:strip-referer:
+ *
+ * Whether to strip referrer details sent to external sites.
+ *
+ * Since: 0.3.4
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_STRIP_REFERER,
+ g_param_spec_boolean (
+ "strip-referer",
+ /* i18n: Reworded: Shorten details propagated when going to another page */
+ _("Strip referrer details sent to external sites"),
+ /* i18n: Referer here is not a typo but a technical term */
+ _("Whether the \"Referer\" header should be shortened to the hostname"),
+ FALSE,
+ flags));
}
case PROP_CLEAR_DATA:
katze_assign (web_settings->clear_data, g_value_dup_string (value));
break;
+ case PROP_STRIP_REFERER:
+ web_settings->strip_referer = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_CLEAR_DATA:
g_value_set_string (value, web_settings->clear_data);
break;
+ case PROP_STRIP_REFERER:
+ g_value_set_boolean (value, web_settings->strip_referer);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;