Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Me-no-dev
#48402
Code: Select allconst char ContentOne[] PROGMEM = "......";
const char ContentTwo[] PROGMEM = "......";
httpServer.setContentLength(strlen_P(ContentOne) + strlen_P(ContentTwo));
httpServer.send(200, "text/html", "" );
httpServer.sendContent_P( ContentOne );
httpServer.sendContent_P( ContentTwo );
User avatar
By Subhajit Das
#48406
Me-no-dev wrote:
Code: Select allconst char ContentOne[] PROGMEM = "......";
const char ContentTwo[] PROGMEM = "......";
httpServer.setContentLength(strlen_P(ContentOne) + strlen_P(ContentTwo));
httpServer.send(200, "text/html", "" );
httpServer.sendContent_P( ContentOne );
httpServer.sendContent_P( ContentTwo );

Why so late man? I did not see the 'setContentLength()' method. So I had to add another method headers :
Code: Select allvoid ESP8266WebServer::sendDefaultHeaders(int code, const char* content_type, size_t contentLength) {
    String header;
    _prepareHeader(header, code, content_type, contentLength);
    sendContent(header);
}

Thanks for the knowledge though.
Limitation of your suggested method is that I have to setContentLength for everytime i send some multipart data, plus extra function calls.
User avatar
By Me-no-dev
#48409 the stock web server does not transmit/support chunked content, so if you want to send some page that is comprised from different chunks, you need to know the final content length before you send the response, else the browser will wait for more data and keep the connection open (or not expect data at all if ContentLength is zero and close after the headers).