Closed r-p-d closed 2 years ago
HI @r-p-d
Thanks for your interest in the library and your effort to post the issue.
Please also follow the instructions to post the MRE so that anybody can easily duplicate the issue then fix, if the issue is real.
Your post even has no info about the board, WiFi hardware / library, etc.
Next time, the similar info-lacking post will be deleted right away
Anyway, the send_P()
is prototyped as
void send_P(int code, PGM_P content_type, PGM_P content, size_t contentLength);
where : content is PGM_P
(PROGMEM pointer)
You already badly copy (without the terminating NULL character) to
char content[sizeof(INDEX_HTML1)]; <====== Bad Bad. must be sizeof(INDEX_HTML1) + 1
so you can't use send_P()
anymore, just use send()
, such as
char content[sizeof(INDEX_HTML1) + 1];
memcpy_P(content, INDEX_HTML1, sizeof(INDEX_HTML1));
server.send(200, "text/html", content, sizeof(content));
It's better to use original PROGMEM-stored INDEX_HTML1 (if not, why use PROGMEM anyway ???), such as
server.send_P(200, "text/html", INDEX_HTML1, sizeof(INDEX_HTML1));
I have a quite straightforward implementation:
with INDEX_HTML being an ~7kb string with HTML content
Running this yields the following data corruption:
Tried to go down the source code, but couldn't find a thing. Would you kindly be able to confirm the bug?