diff --git a/data/comp.html.gz b/data/comp.html.gz
new file mode 100644
index 0000000..ed3aee4
Binary files /dev/null and b/data/comp.html.gz differ
diff --git a/data/compress.html b/data/compress.html
new file mode 100644
index 0000000..e806476
--- /dev/null
+++ b/data/compress.html
@@ -0,0 +1,12 @@
+
+
+
+
+ Ich bin ein komrpimierter Test
+ I bims der Head
+
+
+ I bims der Body
+
+
+
\ No newline at end of file
diff --git a/data/compress.html.gz b/data/compress.html.gz
index 0ae04ee..4f0b001 100644
Binary files a/data/compress.html.gz and b/data/compress.html.gz differ
diff --git a/lib/httpserver/httpserver.h b/lib/httpserver/httpserver.h
index 3a7e848..3574b55 100644
--- a/lib/httpserver/httpserver.h
+++ b/lib/httpserver/httpserver.h
@@ -46,6 +46,34 @@ public:
streamFile(f, cont);
}
});
+ on("/comp.html", [this]() {
+ File f = open("/comp.html.gz");
+ if (!f) {
+ Serial.println("Failed to open file for reading");
+
+ }
+ else
+ {
+ Serial.println("Streaming /comp.html.gz to client");
+ const String cont = "text/html";
+ streamFile(f, cont);
+ }
+ });
+ onNotFound([this]() {
+ String message = "File Not Found\n\n";
+ message += "URI: ";
+ message += uri();
+ message += "\nMethod: ";
+ message += (method() == HTTP_GET) ? "GET" : "POST";
+ message += "\nArguments: ";
+ message += args();
+ message += "\n";
+
+ for (uint8_t i = 0; i < args(); i++) {
+ message += " " + argName(i) + ": " + arg(i) + "\n";
+ }
+ send(404, "text/plain", message);
+ });
if( this->addRootFileHandler() ){
this->begin();
diff --git a/src/main.cpp b/src/main.cpp
index 9079023..bffeab4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -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();