How can I parse client's http requests while using the ESP32 as the access point?
Posted: 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. 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.
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);
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.