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

jaldunate
Posts: 3
Joined: Tue May 14, 2019 12:55 pm

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

Postby jaldunate » Tue May 14, 2019 1:06 pm

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.

metered
Posts: 9
Joined: Mon May 06, 2019 1:29 am

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

Postby metered » Thu May 16, 2019 11:37 pm

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

Who is online

Users browsing this forum: Baidu [Spider] and 67 guests