From: Sébastien Marie Date: Fri, 13 Feb 2015 13:02:27 +0000 (+0100) Subject: hsts: reload only the main frame X-Git-Url: https://git.owens.tech/git.owens.tech/git.owens.tech/git?a=commitdiff_plain;h=131192c35cf92818d6fa1c0170577d94ef1e6de1;p=vimb.git hsts: reload only the main frame HSTS in done using requeueing. But due to a bug in webkit, a reload of the frame could be required in order to display the redirected URI (and not the original one). The patch force this reload only for the mainframe (where the correct URI is need), and not for the subframe (where the HSTS stuff is done by requeueing). Original idea from @fanglingsu --- diff --git a/src/main.c b/src/main.c index ace1449..5438ee5 100644 --- a/src/main.c +++ b/src/main.c @@ -1244,15 +1244,20 @@ static gboolean navigation_decision_requested_cb(WebKitWebView *view, 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_frame_load_uri(frame, uri); - webkit_web_policy_decision_ignore(policy); - - g_free(uri); - /* mark the request as handled */ - return true; + /* + * manually reload the page for HSTS only when it occurs in + * the main-frame. the others cases are covered by requeueing. + */ + if ( webkit_web_view_get_main_frame(view) == frame ) { + uri = hsts_get_changed_uri(vb.session, msg); + if (uri) { + webkit_web_frame_load_uri(frame, uri); + webkit_web_policy_decision_ignore(policy); + + g_free(uri); + /* mark the request as handled */ + return true; + } } #endif