From: Daniel Carl Date: Thu, 27 Nov 2014 22:10:53 +0000 (+0100) Subject: Move hsts check back to resource-request-starting (#146). X-Git-Url: https://git.owens.tech///git?a=commitdiff_plain;h=2ce5f3ef904705b813334d7f6183f858e4d6b2ec;p=vimb.git Move hsts check back to resource-request-starting (#146). --- diff --git a/src/main.c b/src/main.c index 6c9d90e..c2bfcec 100644 --- a/src/main.c +++ b/src/main.c @@ -627,6 +627,16 @@ static void webview_request_starting_cb(WebKitWebView *view, return; } +#ifdef FEATURE_HSTS + /* change uri for known and valid hsts hosts */ + char *new_uri = hsts_get_changed_uri(vb.session, msg); + if (new_uri) { + webkit_network_request_set_uri(req, new_uri); + g_free(new_uri); + return; + } +#endif + if (!vb.config.headers) { return; } @@ -1209,22 +1219,6 @@ static gboolean navigation_decision_requested_cb(WebKitWebView *view, WebKitWebNavigationAction *action, WebKitWebPolicyDecision *policy, gpointer data) { -#ifdef FEATURE_HSTS - char *uri; - SoupMessage *msg = webkit_network_request_get_message(request); - - /* change uri for known and valid hsts hosts */ - uri = hsts_get_changed_uri(vb.session, msg); - if (uri) { - webkit_web_view_load_uri(view, uri); - webkit_web_policy_decision_ignore(policy); - - g_free(uri); - /* mark the request as handled */ - return true; - } -#endif - /* try to find a protocol handler to open the uri */ if (handle_uri(webkit_network_request_get_uri(request))) { webkit_web_policy_decision_ignore(policy);