mirror of
https://github.com/scottchiefbaker/ESP-WebOTA.git
synced 2024-08-30 18:12:33 +00:00
Don't close the connections, it's slows things WAY down
This commit is contained in:
parent
02c6dd785b
commit
7c0912733d
@ -112,20 +112,17 @@ int init_wifi(const char *ssid, const char *password, const char *mdns_hostname)
|
|||||||
int init_web_ota(WebServer *server) {
|
int init_web_ota(WebServer *server) {
|
||||||
// Login page
|
// Login page
|
||||||
server->on("/", HTTP_GET, [server]() {
|
server->on("/", HTTP_GET, [server]() {
|
||||||
server->sendHeader("Connection", "close");
|
|
||||||
server->send(200, "text/html", indexPage);
|
server->send(200, "text/html", indexPage);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Upload firmware page
|
// Upload firmware page
|
||||||
server->on("/webota", HTTP_GET, [server]() {
|
server->on("/webota", HTTP_GET, [server]() {
|
||||||
server->sendHeader("Connection", "close");
|
|
||||||
String ota_html = get_ota_html();
|
String ota_html = get_ota_html();
|
||||||
server->send(200, "text/html", ota_html.c_str());
|
server->send(200, "text/html", ota_html.c_str());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handling uploading firmware file
|
// Handling uploading firmware file
|
||||||
server->on("/update", HTTP_POST, [server]() {
|
server->on("/update", HTTP_POST, [server]() {
|
||||||
server->sendHeader("Connection", "close");
|
|
||||||
server->send(200, "text/plain", (Update.hasError()) ? "FAIL" : "OK");
|
server->send(200, "text/plain", (Update.hasError()) ? "FAIL" : "OK");
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}, [server]() {
|
}, [server]() {
|
||||||
|
Loading…
Reference in New Issue
Block a user