mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-19 09:16:41 +00:00
Fix duplicate response headers #834
This commit is contained in:
parent
62154fb35b
commit
78a3b38829
@ -264,18 +264,18 @@ static void webSendFooter()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void http_send_cache_header(int size, int age = 3600)
|
static void http_send_cache_header(int age = 3600)
|
||||||
{
|
{
|
||||||
webServer.sendHeader("Content-Length", (String)(size));
|
|
||||||
webServer.sendHeader("Cache-Control", (String)(F("public, max-age=")) + (String)(age));
|
webServer.sendHeader("Cache-Control", (String)(F("public, max-age=")) + (String)(age));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int http_send_cached(int statuscode, const char* contenttype, const char* data, size_t size, int age = 3600)
|
static int http_send_cached(int statuscode, const char* contenttype, const char* data, size_t size, int age = 3600)
|
||||||
{
|
{
|
||||||
http_send_cache_header(size, age);
|
http_send_cache_header(age);
|
||||||
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
||||||
webServer.send_P(statuscode, contenttype, data, size);
|
webServer.send_P(statuscode, contenttype, data, size);
|
||||||
#else
|
#else
|
||||||
|
webServer.sendHeader("Content-Length", (String)(size));
|
||||||
webServer.send(statuscode, contenttype, data);
|
webServer.send(statuscode, contenttype, data);
|
||||||
#endif
|
#endif
|
||||||
return statuscode;
|
return statuscode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user