further improvments, [this] in lambda fcn callback, compressed gz webfiles via streamFile()
This commit is contained in:
+1
-19
@@ -34,8 +34,7 @@ void timerCallback(void *pArg)
|
||||
stairs.task();
|
||||
}
|
||||
|
||||
// HTTP
|
||||
void handleNotFound();
|
||||
// port 80, root directory of server '/'
|
||||
HTTPServer httpServer(80, "/");
|
||||
|
||||
uint32_t _t=0;
|
||||
@@ -44,22 +43,6 @@ uint32_t _t=0;
|
||||
// ===============================================
|
||||
|
||||
|
||||
void handleNotFound() {
|
||||
String message = "File Not Found\n\n";
|
||||
message += "URI: ";
|
||||
message += httpServer.uri();
|
||||
message += "\nMethod: ";
|
||||
message += (httpServer.method() == HTTP_GET) ? "GET" : "POST";
|
||||
message += "\nArguments: ";
|
||||
message += httpServer.args();
|
||||
message += "\n";
|
||||
|
||||
for (uint8_t i = 0; i < httpServer.args(); i++) {
|
||||
message += " " + httpServer.argName(i) + ": " + httpServer.arg(i) + "\n";
|
||||
}
|
||||
|
||||
httpServer.send(404, "text/plain", message);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
#ifdef WITH_DEBUGGING_ON
|
||||
@@ -95,7 +78,6 @@ void setup() {
|
||||
ota_setup();
|
||||
|
||||
httpServer.start();
|
||||
httpServer.onNotFound(handleNotFound);
|
||||
Serial.println("HTTP server started !");
|
||||
|
||||
stairs.setup();
|
||||
|
||||
Reference in New Issue
Block a user