Add a flag and toggle keybinding for strict TLS

This commit is contained in:
Quentin Rameau 2017-04-19 18:35:16 +02:00
parent a981959124
commit 27cec48408
3 changed files with 15 additions and 4 deletions

View file

@ -153,6 +153,7 @@ static Key keys[] = {
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } }, { MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_v, toggle, { .i = Plugins } }, { MODKEY|GDK_SHIFT_MASK, GDK_KEY_v, toggle, { .i = Plugins } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } }, { MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } }, { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } },
}; };

11
surf.1
View file

@ -3,7 +3,7 @@
surf \- simple webkit-based browser surf \- simple webkit-based browser
.SH SYNOPSIS .SH SYNOPSIS
.B surf .B surf
.RB [-bBdDfFgGiIkKmMnNpPsSvx] .RB [-bBdDfFgGiIkKmMnNpPsStTvx]
.RB [-a\ cookiepolicies] .RB [-a\ cookiepolicies]
.RB [-c\ cookiefile] .RB [-c\ cookiefile]
.RB [-C\ stylefile] .RB [-C\ stylefile]
@ -107,6 +107,12 @@ Disable Javascript
.B \-S .B \-S
Enable Javascript Enable Javascript
.TP .TP
.B \-t
Disable strict TLS check
.TP
.B \-T
Enable strict TLS check
.TP
.B \-u useragent .B \-u useragent
Specify the Specify the
.I useragent .I useragent
@ -217,6 +223,9 @@ Open the Web Inspector (Developer Tools) window for the current page.
.B Ctrl\-Shift\-s .B Ctrl\-Shift\-s
Toggle script execution. This will reload the page. Toggle script execution. This will reload the page.
.TP .TP
.B Ctrl\-Shift\-t
Toggle strict TLS check. This will reload the page.
.TP
.B Ctrl\-Shift\-v .B Ctrl\-Shift\-v
Toggle the enabling of plugins on that surf instance. This will reload the Toggle the enabling of plugins on that surf instance. This will reload the
page. page.

7
surf.c
View file

@ -226,7 +226,7 @@ static void clicknewwindow(Client *c, const Arg *a, WebKitHitTestResult *h);
static void clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h); static void clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h);
static char winid[64]; static char winid[64];
static char togglestats[10]; static char togglestats[11];
static char pagestats[2]; static char pagestats[2];
static Atom atoms[AtomLast]; static Atom atoms[AtomLast];
static Window embed; static Window embed;
@ -569,7 +569,8 @@ gettogglestats(Client *c)
togglestats[6] = curconfig[Plugins].val.b ? 'V' : 'v'; togglestats[6] = curconfig[Plugins].val.b ? 'V' : 'v';
togglestats[7] = curconfig[Style].val.b ? 'M' : 'm'; togglestats[7] = curconfig[Style].val.b ? 'M' : 'm';
togglestats[8] = curconfig[FrameFlattening].val.b ? 'F' : 'f'; togglestats[8] = curconfig[FrameFlattening].val.b ? 'F' : 'f';
togglestats[9] = '\0'; togglestats[9] = curconfig[StrictTLS].val.b ? 'T' : 't';
togglestats[10] = '\0';
} }
void void
@ -715,7 +716,7 @@ setparameter(Client *c, int refresh, ParamName p, const Arg *a)
webkit_web_view_get_context(c->view), a->b ? webkit_web_view_get_context(c->view), a->b ?
WEBKIT_TLS_ERRORS_POLICY_FAIL : WEBKIT_TLS_ERRORS_POLICY_FAIL :
WEBKIT_TLS_ERRORS_POLICY_IGNORE); WEBKIT_TLS_ERRORS_POLICY_IGNORE);
return; /* do not update */ break;
case Style: case Style:
if (a->b) if (a->b)
setstyle(c, getstyle(geturi(c))); setstyle(c, getstyle(geturi(c)));