From 8cf737ae7470f3415080ebb1ddbe58a131490cdf Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Fri, 15 Apr 2016 13:10:01 +0200 Subject: [PATCH] Do ssl check also when the load failed #281. In case strict-ssl where enabled the load commited with our logic to check for certificate errors was not called. So the check is also done when the load failed, to show the state in case the page could not be loaded because of an untrusted certificate. --- src/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main.c b/src/main.c index 6dbc6f6..8dd9bd0 100644 --- a/src/main.c +++ b/src/main.c @@ -828,6 +828,16 @@ static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec) if (src) { WebKitNetworkRequest *req = webkit_web_data_source_get_initial_request(src); uri = webkit_network_request_get_uri(req); + /* set the status */ + if (g_str_has_prefix(uri, "https://")) { + SoupMessage *msg = webkit_network_request_get_message(req); + SoupMessageFlags flags = soup_message_get_flags(msg); + set_status( + (flags & SOUP_MESSAGE_CERTIFICATE_TRUSTED) ? VB_STATUS_SSL_VALID : VB_STATUS_SSL_INVALID + ); + } else { + set_status(VB_STATUS_NORMAL); + } } else { uri = webkit_web_view_get_uri(view); } -- 2.20.1