Skip to content
Permalink
Browse files

Use homepage for HTTPS GET request

Change the additonal GET request to check certs to a HEAD, and cut the
URI to not include any GET arguments.  We don't want to use theu URI
verbatim as it may contain args that should not be repeated.
  • Loading branch information...
jrick committed May 20, 2013
1 parent 8e13331 commit 161448f1d53dba4692990d9c61117d7699902ffd
Showing with 18 additions and 5 deletions.
  1. +2 −4 marco.c
  2. +16 −1 xombrero.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);

@@ -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) {

0 comments on commit 161448f

Please sign in to comment.
You can’t perform that action at this time.