summaryrefslogtreecommitdiff
path: root/embed
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2016-12-03 16:27:28 -0600
committerMichael Catanzaro <mcatanzaro@gnome.org>2016-12-03 16:27:28 -0600
commit12be12ac483001984c1b3b1b17a1b31b5b6f59be (patch)
treebea4557a2b3f766e44602d48741f9f94043e8364 /embed
parent5da7d07062b31c1accbd202e412f13209bf13a24 (diff)
downloadepiphany-12be12ac483001984c1b3b1b17a1b31b5b6f59be.tar.gz
Disable libhttpseverywhere use by default for now
https://bugzilla.gnome.org/show_bug.cgi?id=775575
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-shell.c11
-rw-r--r--embed/web-extension/ephy-uri-tester.c27
-rw-r--r--embed/web-extension/ephy-web-extension.c4
3 files changed, 39 insertions, 3 deletions
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index db3aa3c34..10d74fa0c 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -41,9 +41,12 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <httpseverywhere.h>
#include <stdlib.h>
+#ifdef HAVE_LIBHTTPSEVERYWHERE
+#include <httpseverywhere.h>
+#endif
+
#define PAGE_SETUP_FILENAME "page-setup-gtk.ini"
#define PRINT_SETTINGS_FILENAME "print-settings.ini"
#define OVERVIEW_RELOAD_DELAY 500
@@ -585,6 +588,7 @@ ftp_request_cb (WebKitURISchemeRequest *request)
g_object_unref (app_info);
}
+#ifdef HAVE_LIBHTTPSEVERYWHERE
static void
https_everywhere_update_cb (HTTPSEverywhereUpdater *updater,
GAsyncResult *result)
@@ -602,6 +606,7 @@ https_everywhere_update_cb (HTTPSEverywhereUpdater *updater,
g_warning ("Failed to update HTTPS Everywhere rulesets: %s", error->message);
g_error_free (error);
}
+#endif
static const char *
ephy_embed_shell_ensure_adblock_data_dir (EphyEmbedShell *shell)
@@ -764,12 +769,15 @@ ephy_embed_shell_update_uri_tester (EphyEmbedShell *shell)
if (priv->mode != EPHY_EMBED_SHELL_MODE_TEST &&
priv->mode != EPHY_EMBED_SHELL_MODE_SEARCH_PROVIDER) {
+#ifdef HAVE_LIBHTTPSEVERYWHERE
HTTPSEverywhereContext *context;
HTTPSEverywhereUpdater *updater;
+#endif
if (!priv->uri_tester_update_cancellable)
priv->uri_tester_update_cancellable = g_cancellable_new ();
+#ifdef HAVE_LIBHTTPSEVERYWHERE
/* We might want to be smarter about this in the future. For now,
* trigger an update of the rulesets once each time Epiphany is started. */
context = https_everywhere_context_new ();
@@ -780,6 +788,7 @@ ephy_embed_shell_update_uri_tester (EphyEmbedShell *shell)
NULL);
g_object_unref (context);
g_object_unref (updater);
+#endif
}
}
diff --git a/embed/web-extension/ephy-uri-tester.c b/embed/web-extension/ephy-uri-tester.c
index 43fd3c370..1b25768d6 100644
--- a/embed/web-extension/ephy-uri-tester.c
+++ b/embed/web-extension/ephy-uri-tester.c
@@ -32,10 +32,13 @@
#include <gio/gio.h>
#include <glib/gstdio.h>
-#include <httpseverywhere.h>
#include <libsoup/soup.h>
#include <string.h>
+#ifdef HAVE_LIBHTTPSEVERYWHERE
+#include <httpseverywhere.h>
+#endif
+
#define SIGNATURE_SIZE 8
struct _EphyUriTester {
@@ -63,9 +66,11 @@ struct _EphyUriTester {
GMainLoop *load_loop;
gboolean adblock_loaded;
+#ifdef HAVE_LIBHTTPSEVERYWHERE
gboolean https_everywhere_loaded;
HTTPSEverywhereContext *https_everywhere_context;
+#endif
};
enum {
@@ -505,10 +510,15 @@ static void
ephy_uri_tester_adblock_loaded (EphyUriTester *tester)
{
tester->adblock_loaded = TRUE;
+#ifdef HAVE_LIBHTTPSEVERYWHERE
if (tester->https_everywhere_loaded)
g_main_loop_quit (tester->load_loop);
+#else
+ g_main_loop_quit (tester->load_loop);
+#endif
}
+#ifdef HAVE_LIBHTTPSEVERYWHERE
static void
ephy_uri_tester_https_everywhere_loaded (EphyUriTester *tester)
{
@@ -516,6 +526,7 @@ ephy_uri_tester_https_everywhere_loaded (EphyUriTester *tester)
if (tester->adblock_loaded)
g_main_loop_quit (tester->load_loop);
}
+#endif
static void
file_parse_cb (GDataInputStream *stream, GAsyncResult *result, EphyUriTester *tester)
@@ -594,12 +605,15 @@ ephy_uri_tester_rewrite_uri (EphyUriTester *tester,
return NULL;
}
+#ifdef HAVE_LIBHTTPSEVERYWHERE
if ((flags & EPHY_URI_TEST_HTTPS_EVERYWHERE) && https_everywhere_context_get_initialized (tester->https_everywhere_context))
return https_everywhere_context_rewrite (tester->https_everywhere_context, request_uri);
+#endif
return g_strdup (request_uri);
}
+#ifdef HAVE_LIBHTTPSEVERYWHERE
static void
https_everywhere_context_init_cb (HTTPSEverywhereContext *context,
GAsyncResult *res,
@@ -616,6 +630,7 @@ https_everywhere_context_init_cb (HTTPSEverywhereContext *context,
ephy_uri_tester_https_everywhere_loaded (tester);
}
+#endif
static void
adblock_file_monitor_changed (GFileMonitor *monitor,
@@ -645,10 +660,12 @@ ephy_uri_tester_load_sync (GTask *task,
tester->load_loop = g_main_loop_new (context, FALSE);
g_main_context_push_thread_default (context);
+#ifdef HAVE_LIBHTTPSEVERYWHERE
tester->https_everywhere_context = https_everywhere_context_new ();
https_everywhere_context_init (tester->https_everywhere_context, NULL,
(GAsyncReadyCallback)https_everywhere_context_init_cb,
tester);
+#endif
filter_file = ephy_uri_tester_get_adblock_filer_file (tester->adblock_data_dir);
if (!g_file_query_exists (filter_file, NULL)) {
@@ -776,7 +793,9 @@ ephy_uri_tester_finalize (GObject *object)
g_regex_unref (tester->regex_subdocument);
g_regex_unref (tester->regex_frame_add);
+#ifdef HAVE_LIBHTTPSEVERYWHERE
g_clear_object (&tester->https_everywhere_context);
+#endif
G_OBJECT_CLASS (ephy_uri_tester_parent_class)->finalize (object);
}
@@ -812,7 +831,11 @@ ephy_uri_tester_load (EphyUriTester *tester)
g_return_if_fail (EPHY_IS_URI_TESTER (tester));
- if (tester->adblock_loaded && tester->https_everywhere_loaded)
+ if (tester->adblock_loaded
+#ifdef HAVE_LIBHTTPSEVERYWHERE
+ && tester->https_everywhere_loaded
+#endif
+ )
return;
task = g_task_new (tester, NULL, NULL, NULL);
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index d95f4fa36..71f2c82e5 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -111,6 +111,7 @@ static gboolean
should_use_https_everywhere (const char *request_uri,
const char *redirected_uri)
{
+#ifdef HAVE_LIBHTTPSEVERYWHERE
SoupURI *request_soup_uri;
SoupURI *redirected_soup_uri;
gboolean result = TRUE;
@@ -142,6 +143,9 @@ should_use_https_everywhere (const char *request_uri,
soup_uri_free (redirected_soup_uri);
return result;
+#else
+ return FALSE;
+#endif
}
static gboolean