@@ -385,11 +385,7 @@ void HTTPServer::send(int code, const String& content_type, const String& conten
385385}
386386
387387void HTTPServer::send (int code, const char * content_type, const char * content) {
388- const String passStr = (String)content;
389- if (strlen (content) != passStr.length ()) {
390- log_e (" String cast failed. Use send_P for long arrays" );
391- }
392- send (code, content_type, passStr);
388+ send (code, content_type, content, content ? strlen (content) : 0 );
393389}
394390
395391void HTTPServer::send (int code, const char * content_type, const char * content, size_t contentLength) {
@@ -409,18 +405,14 @@ void HTTPServer::send_P(int code, PGM_P content_type, PGM_P content) {
409405 }
410406
411407 String header;
412- char type[64 ];
413- memccpy_P ((void *)type, (PGM_VOID_P)content_type, 0 , sizeof (type));
414- _prepareHeader (header, code, (const char *)type, contentLength);
408+ _prepareHeader (header, code, content_type, contentLength);
415409 _currentClientWrite (header.c_str (), header.length ());
416410 sendContent_P (content);
417411}
418412
419413void HTTPServer::send_P (int code, PGM_P content_type, PGM_P content, size_t contentLength) {
420414 String header;
421- char type[64 ];
422- memccpy_P ((void *)type, (PGM_VOID_P)content_type, 0 , sizeof (type));
423- _prepareHeader (header, code, (const char *)type, contentLength);
415+ _prepareHeader (header, code, content_type, contentLength);
424416 sendContent (header);
425417 sendContent_P (content, contentLength);
426418}
0 commit comments