setcert: check uri before adding a certificate
Also directly check for https scheme, we won't need a certificate for others.
This commit is contained in:
parent
21d81a71cc
commit
edddfbc14a
12
surf.c
12
surf.c
|
@ -792,14 +792,16 @@ setcert(Client *c, const char *uri)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uri = strstr(uri, "://") + sizeof("://") - 1;
|
if ((uri = strstr(uri, "https://"))) {
|
||||||
host = strndup(uri, strstr(uri, "/") - uri);
|
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);
|
g_object_unref(cert);
|
||||||
|
|
||||||
free(host);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|
Loading…
Reference in New Issue