From 681ec637929350776e521ee0780d5773ba58ddd2 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Sun, 2 May 2021 07:41:57 +0200 Subject: [PATCH] Send 204 for favicon.ico --- src/sys/svc/hasp_http.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/sys/svc/hasp_http.cpp b/src/sys/svc/hasp_http.cpp index 35181dc0..0f7a7956 100644 --- a/src/sys/svc/hasp_http.cpp +++ b/src/sys/svc/hasp_http.cpp @@ -219,12 +219,8 @@ static String getContentType(const String& path) } //////////////////////////////////////////////////////////////////////////////////////////////////// -void webHandleHaspConfig(); -// static inline char* haspDevice.get_hostname() -// { -// return mqttNodeName; -// } +void webHandleHaspConfig(); //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -998,6 +994,11 @@ int handleFileRead(String path) } #endif + if(!strcasecmp_P(path.c_str(), PSTR("/favicon.ico"))) { + webServer.send_P(204, PSTR("image/bmp"), "", 0); // No content + return 204; + } + return 404; // Not found } @@ -1907,11 +1908,14 @@ void httpHandleNotFound() int statuscode = 404; #endif + if(statuscode == 204) return; // No content + #if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) LOG_TRACE(TAG_HTTP, F("Sending %d %s to client connected from: %s"), statuscode, webServer.uri().c_str(), webServer.client().remoteIP().toString().c_str()); #else - // LOG_TRACE(TAG_HTTP,F("Sending 404 to client connected from: %s"), String(webServer.client().remoteIP()).c_str()); + // LOG_TRACE(TAG_HTTP,F("Sending 404 to client connected from: %s"), + // String(webServer.client().remoteIP()).c_str()); #endif if(statuscode == 200) return; // OK