Do ssl check also when the load failed #281.
authorDaniel Carl <danielcarl@gmx.de>
Fri, 15 Apr 2016 11:10:01 +0000 (13:10 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Fri, 15 Apr 2016 11:13:30 +0000 (13:13 +0200)
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

index 6dbc6f6..8dd9bd0 100644 (file)
@@ -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);
                 }