talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 6eb5afe0881e04dc2e77de9cd544d8e550b0cc73
parent 80892ff3389e93a1e6676d9081dd81d0c8f571b0
Author: Orivej Desh <orivej@gmx.fr>
Date:   Wed, 16 Dec 2020 23:50:50 +0000

Disable remote content by using a void proxy

enable-dns-prefetching=0 has stopped blocking remote content after the
switch to webkit2gtk. Disabling it with a false proxy works.

Setting proxy to "" works well with libsoup-backed webkit2gtk since it
prevents any connection attempts. If libcurl-backed webkit2gtk won't
like it, it may be replaced by "http://127.0.0.9:9" (with 9 being
reserved for the discard service, and 127.0.0.9 being more greppable
than 127.0.0.1).

Signed-off-by: paul <paul@claws-mail.org>

Diffstat:
Msrc/plugins/fancy/fancy_viewer.c | 8+++++++-
Msrc/plugins/fancy/fancy_viewer.h | 1+
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/plugins/fancy/fancy_viewer.c b/src/plugins/fancy/fancy_viewer.c @@ -84,7 +84,6 @@ static void fancy_apply_prefs(FancyViewer *viewer) "enable-javascript", viewer->override_prefs_scripts, "enable-plugins", viewer->override_prefs_plugins, "enable-java", viewer->override_prefs_java, - "enable-dns-prefetching", viewer->override_prefs_remote_content, /* "selected-stylesheet-set", viewer->override_stylesheet,*/ #ifdef G_OS_WIN32 "default-font-family", "Arial", @@ -96,6 +95,10 @@ static void fancy_apply_prefs(FancyViewer *viewer) #endif NULL); webkit_web_view_set_settings(viewer->view, viewer->settings); + if (viewer->override_prefs_remote_content) + webkit_web_context_set_network_proxy_settings(webkit_web_context_get_default(), WEBKIT_NETWORK_PROXY_MODE_DEFAULT, NULL); + else + webkit_web_context_set_network_proxy_settings(webkit_web_context_get_default(), WEBKIT_NETWORK_PROXY_MODE_CUSTOM, viewer->no_remote_content_proxy_settings); } static void fancy_auto_load_images_activated(GtkCheckMenuItem *item, FancyViewer *viewer) { @@ -1033,6 +1036,9 @@ static MimeViewer *fancy_viewer_create(void) } */ viewer->settings = webkit_settings_new(); + // Proxy "" makes libsoup backend think that there is no way + // to connect, which is ideal. + viewer->no_remote_content_proxy_settings = webkit_network_proxy_settings_new("", NULL); g_object_set(viewer->settings, "user-agent", "Fancy Viewer", NULL); viewer->scrollwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(viewer->scrollwin), diff --git a/src/plugins/fancy/fancy_viewer.h b/src/plugins/fancy/fancy_viewer.h @@ -93,6 +93,7 @@ struct _FancyViewer GtkWidget *progress; WebKitSettings *settings; + WebKitNetworkProxySettings *no_remote_content_proxy_settings; gboolean printing; gboolean override_prefs_images; gboolean override_prefs_remote_content;