Re: [PATCH 3/3] hs2o: add-free: Fix the php redirect logic.

Jouni Malinen <[email protected]>
Newsgroups gmane.linux.drivers.hostap
Message-ID <[email protected]>
On Fri, Mar 06, 2020 at 02:58:13PM -0800, [email protected] wrote:
> The former did not work, but this code does.  I'm using whatever
> webkit comes with Fedora-27 on this test system.

That is just hiding the real issue on the client side with webkit2; not
fixing anything on the server. In fact, it is making the server not
comply with the Hotspot 2.0 specification since the final redirect at
the end of the user interaction is required to be a HTTP 302 redirect.

I'll fix this in the browser code properly with following:

[PATCH] webkit2: Fix http://localhost:12345/ redirect handling

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 <[email protected]>
---
 src/utils/browser.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/utils/browser.c b/src/utils/browser.c
index f864fbf0e219..c0f4380c4e38 100644
--- a/src/utils/browser.c
+++ b/src/utils/browser.c
@@ -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;
 	}
-- 
2.20.1


-- 
Jouni Malinen                                            PGP id EFC895FA
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.