Allow to toggle insecure websites. - surf - Surf web browser.
       
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 20b2831bbc5937b382725667d474422f2ea183ec
 (DIR) parent 55b66eda460db4e936bd995f7cd048c8438d0975
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Fri, 21 Apr 2017 20:56:14 +0200
       
       Allow to toggle insecure websites.
       
       Diffstat:
         config.def.h                        |       3 +++
         surf.1                              |       8 +++++++-
         surf.c                              |      32 ++++++++++++++++++++++++-------
       
       3 files changed, 35 insertions(+), 8 deletions(-)
       ---
 (DIR) diff --git a/config.def.h b/config.def.h
       @@ -40,6 +40,8 @@ static Bool enablestyle           = TRUE;
        static Bool loadimages            = TRUE;
        static Bool hidebackground        = FALSE;
        static Bool allowgeolocation      = TRUE;
       +static Bool insecureresources     = FALSE; /* Whether to allow to load
       +                                            * non-HTTPS resources in HTTPS pages. */
        
        /*
         * Now on TV: »What is the best User-Agent for me?«
       @@ -167,6 +169,7 @@ static Key keys[] = {
                { MODKEY|GDK_SHIFT_MASK,GDK_i,      toggle,     { .v = "auto-load-images" } },
                { MODKEY|GDK_SHIFT_MASK,GDK_s,      toggle,     { .v = "enable-scripts" } },
                { MODKEY|GDK_SHIFT_MASK,GDK_v,      toggle,     { .v = "enable-plugins" } },
       +        { MODKEY|GDK_SHIFT_MASK,GDK_l,      toggle,     { .v = "enable-display-of-insecure-content" } },
                { MODKEY|GDK_SHIFT_MASK,GDK_t,      togglesoup, { .v = "ssl-strict" } },
                { MODKEY|GDK_SHIFT_MASK,GDK_a,      togglecookiepolicy, { 0 } },
                { MODKEY|GDK_SHIFT_MASK,GDK_m,      togglestyle, { 0 } },
 (DIR) diff --git a/surf.1 b/surf.1
       @@ -3,7 +3,7 @@
        surf \- simple webkit-based browser
        .SH SYNOPSIS
        .B surf
       -.RB [-bBdDfFgGiIkKmMnNpPsStTvx]
       +.RB [-bBdDfFgGiIkKmLlMnNpPsStTvx]
        .RB [-a\ cookiepolicies]
        .RB [-c\ cookiefile]
        .RB [-e\ xid]
       @@ -74,6 +74,12 @@ Disable kiosk mode (disable key strokes and right click)
        .B \-K
        Enable kiosk mode (disable key strokes and right click)
        .TP
       +.B \-l
       +Disable loading of non-HTTPS resources on HTTPS pages.
       +.TP
       +.B \-L
       +Enable loading of non-HTTPS resources on HTTPS pages.
       +.TP
        .B \-m
        Disable application of user style sheets.
        .TP
 (DIR) diff --git a/surf.c b/surf.c
       @@ -109,7 +109,7 @@ static GdkNativeWindow embed = 0;
        static gboolean showxid = FALSE;
        static char winid[64];
        static gboolean usingproxy = 0;
       -static char togglestat[10];
       +static char togglestat[11];
        static char pagestat[3];
        static GTlsDatabase *tlsdb;
        static int policysel = 0;
       @@ -1097,6 +1097,9 @@ newclient(void)
                             "default-encoding", defaultencoding, NULL);
                g_object_set(G_OBJECT(settings),
                             "enable-accelerated-compositing", accelrendering, NULL);
       +        g_object_set(G_OBJECT(settings),
       +                     "enable-display-of-insecure-content", insecureresources,
       +                     NULL);
                if (enablestyle)
                        setstyle(c, getstyle("about:blank"));
        
       @@ -1158,7 +1161,7 @@ void
        newwindow(Client *c, const Arg *arg, gboolean noembed)
        {
                guint i = 0;
       -        const char *cmd[28], *uri;
       +        const char *cmd[29], *uri;
                const Arg a = { .v = (void *)cmd };
                char tmp[64], ztmp[6];
        
       @@ -1210,6 +1213,11 @@ newwindow(Client *c, const Arg *arg, gboolean noembed)
                else
                        cmd[i++] = "-k";
        
       +        if (insecureresources)
       +                cmd[i++] = "-L";
       +        else
       +                cmd[i++] = "-l";
       +
                if (enablestyle)
                        cmd[i++] = "-M";
                else
       @@ -1764,13 +1772,19 @@ gettogglestat(Client *c)
                             NULL);
                togglestat[p++] = value? 'C': 'c';
        
       -        togglestat[p++] = allowgeolocation? 'G': 'g';
       -
                togglestat[p++] = enablediskcache? 'D': 'd';
        
       +        togglestat[p++] = allowgeolocation? 'G': 'g';
       +
                g_object_get(G_OBJECT(settings), "auto-load-images", &value, NULL);
                togglestat[p++] = value? 'I': 'i';
        
       +        g_object_get(G_OBJECT(settings),
       +                        "enable-display-of-insecure-content", &value, NULL);
       +        togglestat[p++] = value? 'L': 'l';
       +
       +        togglestat[p++] = enablestyle ? 'M': 'm';
       +
                g_object_get(G_OBJECT(settings), "enable-scripts", &value, NULL);
                togglestat[p++] = value? 'S': 's';
        
       @@ -1780,8 +1794,6 @@ gettogglestat(Client *c)
                g_object_get(G_OBJECT(settings), "enable-plugins", &value, NULL);
                togglestat[p++] = value? 'V': 'v';
        
       -        togglestat[p++] = enablestyle ? 'M': 'm';
       -
                togglestat[p] = '\0';
        }
        
       @@ -1838,7 +1850,7 @@ updatewinid(Client *c)
        void
        usage(void)
        {
       -        die("usage: %s [-bBdDfFgGiIkKmMnNpPsStTvx] [-a cookiepolicies ] "
       +        die("usage: %s [-bBdDfFgGiIkKlLmMnNpPsStTvx] [-a cookiepolicies ] "
                    "[-c cookiefile] [-e xid] [-r scriptfile] [-y stylefile] "
                    "[-u useragent] [-z zoomlevel] [uri]\n", basename(argv0));
        }
       @@ -1922,6 +1934,12 @@ main(int argc, char *argv[])
                case 'K':
                        kioskmode = 1;
                        break;
       +        case 'L':
       +                insecureresources = 1;
       +                break;
       +        case 'l':
       +                insecureresources = 0;
       +                break;
                case 'm':
                        enablestyle = 0;
                        break;