X-Git-Url: https://git.danieliu.xyz/?p=surf.git;a=blobdiff_plain;f=surf.c;h=0fcf22eca728e2710d40dcc87737a0f1b79c4de5;hp=d67d09bf9766facc5d9a68d43279049c69b9b2fa;hb=d984d12de719f6a8e7f96c04ad3a53ab73a27df8;hpb=21d81a71cc55ea52c836c49eca351940fefb1287 diff --git a/surf.c b/surf.c index d67d09b..0fcf22e 100644 --- a/surf.c +++ b/surf.c @@ -256,9 +256,9 @@ char *argv0; void usage(void) { - die("usage: %s [-bBdDfFgGiIkKmMnNpPsStTvx] [-a cookiepolicies ] " - "[-c cookiefile] [-C stylefile] [-e xid] [-r scriptfile] " - "[-u useragent] [-z zoomlevel] [uri]\n", basename(argv0)); + die("usage: surf [-bBdDfFgGiIkKmMnNpPsStTvwxX]\n" + "[-a cookiepolicies ] [-c cookiefile] [-C stylefile] [-e xid]\n" + "[-r scriptfile] [-u useragent] [-z zoomlevel] [uri]\n"); } void @@ -792,14 +792,16 @@ setcert(Client *c, const char *uri) return; } - uri = strstr(uri, "://") + sizeof("://") - 1; - host = strndup(uri, strstr(uri, "/") - uri); + if ((uri = strstr(uri, "https://"))) { + uri += sizeof("https://") - 1; + host = g_strndup(uri, strchr(uri, '/') - uri); + webkit_web_context_allow_tls_certificate_for_host( + webkit_web_view_get_context(c->view), cert, host); + g_free(host); + } - webkit_web_context_allow_tls_certificate_for_host( - webkit_web_view_get_context(c->view), cert, host); g_object_unref(cert); - free(host); } const char * @@ -1330,7 +1332,7 @@ loadfailedtls(WebKitWebView *v, gchar *uri, GTlsCertificate *cert, g_object_get(cert, "certificate-pem", &pem, NULL); html = g_strdup_printf("

Could not validate TLS for “%s”
%s

" "

You can inspect the following certificate " - "with Ctrl+Shift+x (default keybinding).

" + "with Ctrl-t (default keybinding).

" "

%s

", uri, errmsg->str, pem); g_free(pem); g_string_free(errmsg, TRUE); @@ -1899,8 +1901,7 @@ main(int argc, char *argv[]) fulluseragent = EARGF(usage()); break; case 'v': - die("surf-"VERSION", ©2009-2017 surf engineers, " - "see LICENSE for details\n"); + die("surf-"VERSION", see LICENSE for © details\n"); case 'w': showxid = 1; break;