Skip to content

Commit 26537be

Browse files
committed
temporarly fix for handling PGM_P content_type properly in ESP8266WebServer::send_P() functions
1 parent 63dc2f5 commit 26537be

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,18 @@ void ESP8266WebServer::send_P(int code, PGM_P content_type, PGM_P content) {
164164
}
165165

166166
String header;
167-
_prepareHeader(header, code, String(FPSTR(content_type)).c_str(), contentLength);
167+
char type[64];
168+
memccpy_P((void*)type, (PGM_VOID_P)content_type, 0, sizeof(type));
169+
_prepareHeader(header, code, (const char* )type, contentLength);
168170
sendContent(header);
169171
sendContent_P(content);
170172
}
171173

172174
void ESP8266WebServer::send_P(int code, PGM_P content_type, PGM_P content, size_t contentLength) {
173175
String header;
174-
_prepareHeader(header, code, String(FPSTR(content_type)).c_str(), contentLength);
176+
char type[64];
177+
memccpy_P((void*)type, (PGM_VOID_P)content_type, 0, sizeof(type));
178+
_prepareHeader(header, code, (const char* )type, contentLength);
175179
sendContent(header);
176180
sendContent_P(content, contentLength);
177181
}

0 commit comments

Comments
 (0)