From 307c558801ba06c3a36f88e2ae9dbe208f6a0059 Mon Sep 17 00:00:00 2001 From: Adam Ehlers Nyholm Thomsen Date: Tue, 11 Dec 2012 00:18:41 +0100 Subject: First version of HSTS implementation. --- src/dwb.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/dwb.c') diff --git a/src/dwb.c b/src/dwb.c index 77317d2d..7fdb6f7f 100644 --- a/src/dwb.c +++ b/src/dwb.c @@ -48,6 +48,7 @@ #include "application.h" #include "scripts.h" #include "scratchpad.h" +#include "hsts.h" /* DECLARATIONS {{{*/ static DwbStatus dwb_webkit_setting(GList *, WebSettings *); @@ -175,6 +176,19 @@ dwb_set_adblock(GList *gl, WebSettings *s) } }/*}}}*/ +void +dwb_set_hsts(GList *gl, WebSettings *s) +{ + if (s->arg_local.b) + { + hsts_activate(); + } + else + { + hsts_deactivate(); + } +} + /* dwb_set_cookies {{{ */ static DwbStatus dwb_set_cookies(GList *gl, WebSettings *s) { @@ -3460,6 +3474,7 @@ dwb_free_custom_keys() gboolean dwb_clean_up() { + hsts_end(); /* Assumes it has access to dwb.settings */ for (GList *l = dwb.keymap; l; l=l->next) { KeyMap *m = l->data; if (m->map->prop & CP_SCRIPT) @@ -3495,7 +3510,6 @@ dwb_clean_up() for (GList *gl = dwb.state.views; gl; gl=gl->next) view_clean(gl); - dwb_soup_end(); adblock_end(); @@ -4376,6 +4390,8 @@ dwb_init_files() dwb_check_create(dwb.files[FILES_PLUGINS_ALLOW]); dwb.files[FILES_CUSTOM_KEYS] = g_build_filename(profile_path, "custom_keys", NULL); dwb_check_create(dwb.files[FILES_CUSTOM_KEYS]); + dwb.files[FILES_HSTS] = g_build_filename(profile_path, "hsts", NULL); + dwb_check_create(dwb.files[FILES_HSTS]); userscripts = g_build_filename(path, "userscripts", NULL); dwb.files[FILES_USERSCRIPTS] = util_check_directory(userscripts); @@ -4581,6 +4597,7 @@ dwb_init() dwb_init_hints(NULL, NULL); dwb_soup_init(); + hsts_init(); } /*}}}*/ /*}}}*/ /* FIFO {{{*/ -- cgit debian/1.2.3+git2.25.1-1-2-gaceb0