Right now I have a project [1] that is providing a function to update the firmware via the web server. I know this is not secure and not recommended, but it is also not relevant to my question.
My question; once the firmware update is complete, an esp_restart() is issued to start the new version. Before this happens, I provide a web page that simply states the update was complete and the device will reboot. I want to display this, providing a 15 sec timeout and then redirect to the root of the http server. I have tried so many different ideas but cannot get anything working and I couldn't find an example online.
The first thing I tried was to add the following in the URI handler:
Code: Select all
httpd_resp_set_hdr(req, "Refresh", "content=\"15;url=/\"\r\n");
Code: Select all
httpd_resp_sendstr(req, "Firmware update complete, rebooting now!\n");
...which I get since I didn't add a uri handler method for POST for the root.[19670.15h.36m.01s.574] W (126643) httpd_uri: httpd_uri: Method '1' not allowed for URI '/update'
[19670.15h.36m.01s.574] W (126643) httpd_txrx: httpd_resp_send_err: 405 Method Not Allowed - Specified method is invalid for this resource
What I am trying to do is to reload the root web page after the firmware update and the reboot complete (roughly 10 - 12 seconds).
The module I am working within is app/src/web.cpp in my repo. Near line 277.
[1] https://github.com/smeisner/smart-thermostat