From: Daniel Carl Date: Fri, 15 Apr 2016 11:10:01 +0000 (+0200) Subject: Do ssl check also when the load failed #281. X-Git-Url: https://git.owens.tech/assets/me.jpg/assets/me.jpg/git?a=commitdiff_plain;h=8cf737ae7470f3415080ebb1ddbe58a131490cdf;p=vimb.git 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. --- 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); }