Use Ctrl-t for showcert instead of Ctrl-x
[surf.git] / surf.c
diff --git a/surf.c b/surf.c
index d67d09b..007f7b9 100644 (file)
--- a/surf.c
+++ b/surf.c
@@ -256,7 +256,7 @@ char *argv0;
 void
 usage(void)
 {
-       die("usage: %s [-bBdDfFgGiIkKmMnNpPsStTvx] [-a cookiepolicies ] "
+       die("usage: %s [-bBdDfFgGiIkKmMnNpPsStTvwxX] [-a cookiepolicies ] "
            "[-c cookiefile] [-C stylefile] [-e xid] [-r scriptfile] "
            "[-u useragent] [-z zoomlevel] [uri]\n", basename(argv0));
 }
@@ -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("<p>Could not validate TLS for ā€œ%sā€<br>%s</p>"
                               "<p>You can inspect the following certificate "
-                              "with Ctrl+Shift+x (default keybinding).</p>"
+                              "with Ctrl-t (default keybinding).</p>"
                               "<p><pre>%s</pre></p>", uri, errmsg->str, pem);
        g_free(pem);
        g_string_free(errmsg, TRUE);