1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

temporarly fix for handling PGM_P content_type properly in ESP8266WebServer::send_P() functions

This commit is contained in:
Martin Ayotte
2015-09-09 12:03:07 -04:00
parent 348efba5b2
commit 5cb086bc05

View File

@ -164,14 +164,18 @@ void ESP8266WebServer::send_P(int code, PGM_P content_type, PGM_P content) {
}
String header;
_prepareHeader(header, code, String(FPSTR(content_type)).c_str(), contentLength);
char type[64];
memccpy_P((void*)type, (PGM_VOID_P)content_type, 0, sizeof(type));
_prepareHeader(header, code, (const char* )type, contentLength);
sendContent(header);
sendContent_P(content);
}
void ESP8266WebServer::send_P(int code, PGM_P content_type, PGM_P content, size_t contentLength) {
String header;
_prepareHeader(header, code, String(FPSTR(content_type)).c_str(), contentLength);
char type[64];
memccpy_P((void*)type, (PGM_VOID_P)content_type, 0, sizeof(type));
_prepareHeader(header, code, (const char* )type, contentLength);
sendContent(header);
sendContent_P(content, contentLength);
}