]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
webkit2: Fix http://localhost:12345/ redirect handling
authorJouni Malinen <j@w1.fi>
Sat, 7 Mar 2020 09:51:23 +0000 (11:51 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 7 Mar 2020 09:51:23 +0000 (11:51 +0200)
The resource-load-started cannot be used to replace the older
resource-request-starting signal and as such, the final redirect to the
special http://localhost:12345/ URL did not work. Use the decide-policy
signal for navigation action instead.

Also remove the attempt to modify the request URI from
resource-load-started since that is not going to work either. This is
not really critical for functionality, but could eventually be replaced
with a handler for the WebKitWebPage send-request signal.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/utils/browser.c

index f864fbf0e219afbd99af2830b43c34e99eb13b29..c0f4380c4e3844dd427528f2b9b695522a55e7f3 100644 (file)
@@ -107,9 +107,6 @@ static void view_cb_resource_load_starting(WebKitWebView *view,
        const gchar *uri = webkit_uri_request_get_uri(req);
 
        wpa_printf(MSG_DEBUG, "BROWSER:%s uri=%s", __func__, uri);
-       if (g_str_has_suffix(uri, "/favicon.ico"))
-               webkit_uri_request_set_uri(req, "about:blank");
-
        process_request_starting_uri(ctx, uri);
 }
 
@@ -134,6 +131,21 @@ static gboolean view_cb_decide_policy(WebKitWebView *view,
                }
                break;
        }
+       case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION: {
+               WebKitNavigationPolicyDecision *d;
+               WebKitNavigationAction *a;
+               WebKitURIRequest *req;
+               const gchar *uri;
+
+               d = WEBKIT_NAVIGATION_POLICY_DECISION(policy);
+               a = webkit_navigation_policy_decision_get_navigation_action(d);
+               req = webkit_navigation_action_get_request(a);
+               uri = webkit_uri_request_get_uri(req);
+               wpa_printf(MSG_DEBUG, "BROWSER:%s navigation action: uri=%s",
+                          __func__, uri);
+               process_request_starting_uri(ctx, uri);
+               break;
+       }
        default:
                break;
        }