Page 1 of 1

How can I parse client's http requests while using the ESP32 as the access point?

Posted: Tue May 14, 2019 1:06 pm
by jaldunate
I've been learning how to use the ESP32 as a web host and also as an access point, both, being a "captive portal" and also sending astray bytes.

I noted that the WebServer.h library offers a nice callback function that you can use when a client request files

Code: Select all

server.on("/", handleRoot);
. I have tried mounting a webserver that connects to my router, and I can visit using the IP that the router gives it.

The thing I cannot figure out how to do, is to use this WebServer library, or at least it's underlying request parser to handle a WifiClient. I know how to read and write bytes from and to a wifi client, but I feel it wouldn't be smart to write a http request parser given that WebServer library already has one.

All the Arduino esp32 examples either use the wifiClient alone, or the webserver alone (needing an external router). I want to make something like the captive portal example, but be able to parse the http request (path, get vars, etc.) and send different text/html contents accordingly.

Re: How can I parse client's http requests while using the ESP32 as the access point?

Posted: Thu May 16, 2019 11:37 pm
by metered
If the right libraries are installed and you have the board set to the right ESP then you should see some extra demos in the File menu under Examples, scroll down until you find WiFi, then WiFiAccessPoint