diff -r e577a59fcd63 config.mk --- a/config.mk Sat Mar 30 15:03:46 2013 +0100 +++ b/config.mk Sun Apr 07 23:19:35 2013 +0200 @@ -146,10 +146,17 @@ CFLAGS += -DWITH_LIBSOUP_2_38=1 endif +ifeq (${DISABLE_HSTS}, 1) +CFLAGS += -DDISABLE_HSTS +else +M4FLAGS += --define=WITH_HSTS=1 +endif + # If execinfo.h is not available, e.g. freebsd ifneq (${WITHOUT_EXECINFO}, 1) CFLAGS += -DHAS_EXECINFO endif + CFLAGS_OPTIONS := $(CFLAGS) ifeq (USEGTK3, 1) diff -r e577a59fcd63 m4/settings.m4 --- a/m4/settings.m4 Sat Mar 30 15:03:46 2013 +0100 +++ b/m4/settings.m4 Sun Apr 07 23:19:35 2013 +0200 @@ -122,7 +122,9 @@ html_input(enable-java-applet, checkbox, Whether to enable java applets) html_input(enable-plugins, checkbox, Whether to enable plugins) html_input(enable-scripts, checkbox, Enable embedded scripting languages) +ifdef(`WITH_HSTS', html_input(hsts, checkbox, Whether HSTS support should be enabled) +) html_input(javascript-can-access-clipboard, checkbox, Whether javascript can access the clipboard) html_input(javascript-can-open-windows-automatically, checkbox, Whether javascript can open windows) html_input(javascript-schemes, checkbox, Whether to allow loading url with scheme "javascript") diff -r e577a59fcd63 src/config.h --- a/src/config.h Sat Mar 30 15:03:46 2013 +0100 +++ b/src/config.h Sun Apr 07 23:19:35 2013 +0200 @@ -1147,8 +1147,10 @@ SETTING_GLOBAL, BOOLEAN, { .b = false }, (S_Func)dwb_set_adblock, { 0 }, }, { { "adblocker-filterlist", "Path to a filterlist", }, SETTING_GLOBAL, CHAR, { .p = NULL }, NULL, { 0 }, }, +#ifndef DISABLE_HSTS { { "hsts", "Whether HSTS support should be enabled",}, SETTING_GLOBAL, BOOLEAN, { .b = false }, (S_Func)dwb_set_hsts, { 0 }, }, +#endif #ifdef WITH_LIBSOUP_2_38 { { "addressbar-dns-lookup", "Whether to perform a dns check for text typed into the address bar", }, SETTING_GLOBAL | SETTING_ONINIT, BOOLEAN, { .b = false }, (S_Func)dwb_set_dns_lookup, { 0 }, }, diff -r e577a59fcd63 src/dwb.c --- a/src/dwb.c Sat Mar 30 15:03:46 2013 +0100 +++ b/src/dwb.c Sun Apr 07 23:19:35 2013 +0200 @@ -48,7 +48,10 @@ #include "application.h" #include "scripts.h" #include "dom.h" + +#ifndef DISABLE_HSTS #include "hsts.h" +#endif /* DECLARATIONS {{{*/ static DwbStatus dwb_webkit_setting(GList *, WebSettings *); @@ -193,6 +196,7 @@ g_object_set(webkit_get_default_session(), "accept-language", s->arg_local.p, NULL); return STATUS_OK; }/*}}}*/ +#ifndef DISABLE_HSTS void dwb_set_hsts(GList *gl, WebSettings *s) { @@ -205,6 +209,7 @@ hsts_deactivate(); } } +#endif /*{{{*/ //static DwbStatus @@ -3449,7 +3454,9 @@ for (GList *gl = dwb.state.views; gl; gl=gl->next) view_clean(gl); +#ifndef DISABLE_HSTS hsts_end(); /* Assumes it has access to dwb.settings */ +#endif for (GList *l = dwb.keymap; l; l=l->next) { KeyMap *m = l->data; if (m->map->prop & CP_SCRIPT) @@ -4410,8 +4417,10 @@ 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]); +#ifndef DISABLE_HSTS dwb.files[FILES_HSTS] = g_build_filename(profile_path, "hsts", NULL); dwb_check_create(dwb.files[FILES_HSTS]); +#endif userscripts = g_build_filename(path, "userscripts", NULL); dwb.files[FILES_USERSCRIPTS] = util_check_directory(userscripts); @@ -4621,7 +4630,9 @@ dwb_init_hints(NULL, NULL); dwb_soup_init(); +#ifndef DISABLE_HSTS hsts_init(); +#endif } /*}}}*/ /*}}}*/ /* FIFO {{{*/ diff -r e577a59fcd63 src/dwb.h --- a/src/dwb.h Sat Mar 30 15:03:46 2013 +0100 +++ b/src/dwb.h Sun Apr 07 23:19:35 2013 +0200 @@ -810,7 +810,9 @@ FILES_COOKIES_SESSION_ALLOW, FILES_DOWNLOAD_PATH, FILES_HISTORY, +#ifndef DISABLE_HSTS FILES_HSTS, +#endif FILES_KEYS, FILES_MIMETYPES, FILES_QUICKMARKS, @@ -968,7 +970,9 @@ gboolean dwb_entry_activate(GdkEventKey *e); void dwb_set_adblock(GList *, WebSettings *); +#ifndef DISABLE_HSTS void dwb_set_hsts(GList *, WebSettings *); +#endif gboolean dwb_eval_key(GdkEventKey *); gboolean dwb_eval_override_key(GdkEventKey *e, CommandProperty prop); diff -r e577a59fcd63 src/hsts.c --- a/src/hsts.c Sat Mar 30 15:03:46 2013 +0100 +++ b/src/hsts.c Sun Apr 07 23:19:35 2013 +0200 @@ -15,6 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef DISABLE_HSTS #include #include #include @@ -920,3 +921,4 @@ s_init = false; } } +#endif diff -r e577a59fcd63 src/hsts.h --- a/src/hsts.h Sat Mar 30 15:03:46 2013 +0100 +++ b/src/hsts.h Sun Apr 07 23:19:35 2013 +0200 @@ -16,6 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef DISABLE_HSTS #ifndef HSTS_H #define HSTS_H @@ -27,3 +28,4 @@ void hsts_deactivate(); #endif // HSTS_H +#endif diff -r e577a59fcd63 src/util/Makefile --- a/src/util/Makefile Sat Mar 30 15:03:46 2013 +0100 +++ b/src/util/Makefile Sun Apr 07 23:19:35 2013 +0200 @@ -8,6 +8,7 @@ MKTLDS=mktlds-header MKTLDS_SRC=mktlds-header.c + HSTS=convert_transport_security HSTS_PRELOAD=$(BASE_DIR)/$(SRCDIR)/hsts_preload.h TRANSPORT_SECURITY_JSON=transport_security_state_static.json @@ -17,8 +18,14 @@ CFLAGS+=$(shell pkg-config --cflags $(LIBS)) LDFLAGS=$(shell pkg-config --libs $(LIBS)) +ifeq (${DISABLE_HSTS}, 1) +OUTFILES=$(TLDS_H) +GEN_TOOLS=$(MKTLDS) +else +GEN_TOOLS=$(HSTS) $(MKTLDS) OUTFILES=$(HSTS_PRELOAD) $(TLDS_H) -GEN_TOOLS=$(HSTS) $(MKTLDS) +endif + all: $(OUTFILES)