diff options
-rw-r--r-- | marco.c | 6 | ||||
-rw-r--r-- | xombrero.c | 17 |
2 files changed, 18 insertions, 5 deletions
diff --git a/marco.c b/marco.c index 3731af8..6b8cbf6 100644 --- a/marco.c +++ b/marco.c @@ -39,12 +39,11 @@ static const char *message[] = { }; const char * -marco_message(int *len) +marco_message(void) { const char *str; str = message[arc4random_uniform(sizeof(message)/sizeof(message[0]))]; - *len = strlen(str); return str; } @@ -53,13 +52,12 @@ int marco(struct tab *t, struct karg *args) { char *page, line[64 * 1024]; - int len; if (t == NULL) show_oops(NULL, "marco invalid parameters"); line[0] = '\0'; - snprintf(line, sizeof line, "%s", marco_message(&len)); + snprintf(line, sizeof line, "%s", marco_message()); page = get_html_page("Marco Sez...", line, "", 0); diff --git a/xombrero.c b/xombrero.c index 057b61d..50f869d 100644 --- a/xombrero.c +++ b/xombrero.c @@ -3634,7 +3634,9 @@ show_ca_status(struct tab *t, const char *uri) GTlsCertificate *cert = NULL; GTlsCertificateFlags flags = 0; gchar *col_str = XT_COLOR_RED; + char *cut_uri; char *chain; + char *s; #if GTK_CHECK_VERSION(3, 0, 0) char *name; #else @@ -3655,9 +3657,22 @@ show_ca_status(struct tab *t, const char *uri) !g_str_has_prefix(uri, "https://")) return; - msg = soup_message_new("GET", uri); + /* + * Cut the uri to get the certs off the homepage. We can't use the + * full URI here since it may include arguments and we don't want to make + * these requests multiple times. + */ + cut_uri = g_strdup(uri); + s = cut_uri; + for (i = 0; i < 3; ++i) + s = strchr(&(s[1]), '/'); + s[1] = '\0'; + + msg = soup_message_new("HEAD", cut_uri); + g_free(cut_uri); if (msg == NULL) return; + soup_message_set_flags(msg, SOUP_MESSAGE_NO_REDIRECT); soup_session_send_message(session, msg); if (msg->status_code == SOUP_STATUS_SSL_FAILED || msg->status_code == SOUP_STATUS_TLS_FAILED) { |