20 #include "../../../include/esp3d_config.h"
21 #if defined (HTTP_FEATURE)
22 #include "../http_server.h"
23 #if defined (ARDUINO_ARCH_ESP32)
24 #include <WebServer.h>
25 #endif //ARDUINO_ARCH_ESP32
26 #if defined (ARDUINO_ARCH_ESP8266)
27 #include <ESP8266WebServer.h>
28 #endif //ARDUINO_ARCH_ESP8266
29 #include "../../filesystem/esp_filesystem.h"
30 #include "../../authentication/authentication_service.h"
33 void HTTP_Server:: handle_not_found()
36 _webserver->sendContent(
"HTTP/1.1 301 OK\r\nLocation: /\r\nCache-Control: no-cache\r\n\r\n");
39 String path = _webserver->urlDecode(_webserver->uri());
40 String contentType = getContentType(path.c_str());
41 String pathWithGz = path +
".gz";
42 #if defined (FILESYSTEM_FEATURE)
47 if(!StreamFSFile(path.c_str(),contentType.c_str())) {
48 log_esp3d(
"Stream `%s` failed", path.c_str());
52 #endif //#if defined (FILESYSTEM_FEATURE)
54 #ifdef FILESYSTEM_FEATURE
57 contentType = getContentType(path.c_str());
58 pathWithGz = path +
".gz";
63 if(!StreamFSFile(path.c_str(),contentType.c_str())) {
64 log_esp3d(
"Stream `%s` failed", path.c_str());
68 #endif //FILESYSTEM_FEATURE
70 _webserver->send(404);
100 #endif //HTTP_FEATURE