From 089fe8fca77c775e604abb8b70d0d5d51d51db75 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Mon, 4 Dec 2023 16:01:57 +0100 Subject: [PATCH] use uriglob to catch all android captive portal requests (#9041) --- .../examples/CaptivePortalAdvanced/CaptivePortalAdvanced.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/DNSServer/examples/CaptivePortalAdvanced/CaptivePortalAdvanced.ino b/libraries/DNSServer/examples/CaptivePortalAdvanced/CaptivePortalAdvanced.ino index 55222fbc7..1aef1afd2 100644 --- a/libraries/DNSServer/examples/CaptivePortalAdvanced/CaptivePortalAdvanced.ino +++ b/libraries/DNSServer/examples/CaptivePortalAdvanced/CaptivePortalAdvanced.ino @@ -4,6 +4,7 @@ #include #include #include +#include /* This example serves a "hello world" on a WLAN and a SoftAP at the same time. @@ -74,8 +75,8 @@ void setup() { server.on("/", handleRoot); server.on("/wifi", handleWifi); server.on("/wifisave", handleWifiSave); - server.on("/generate_204", handleRoot); // Android captive portal. Maybe not needed. Might be handled by notFound handler. - server.on("/fwlink", handleRoot); // Microsoft captive portal. Maybe not needed. Might be handled by notFound handler. + server.on(UriGlob("/generate_204*"), handleRoot); // Android captive portal. Handle "/generate_204_"-like requests. Might be handled by notFound handler. + server.on("/fwlink", handleRoot); // Microsoft captive portal. Maybe not needed. Might be handled by notFound handler. server.onNotFound(handleNotFound); server.begin(); // Web server start Serial.println("HTTP server started");