I have 15 html files, all of which uses a lot of JS linked locally and every html has different <body> (each file has about 100kB of <body>). I won't be able to store it inside ESP32 Flash without compression. I converted index.html into single file using https://github.com/remy/inliner and then to char array (about 1.5MB) and everything works fine when I use:
Code: Select all
httpd_resp_send(req, index_html_whole, HTTPD_RESP_USE_STRLEN);
Code: Select all
httpd_resp_set_hdr(req, "Content-Encoding", "gzip");
httpd_resp_set_type(req, "text/html");
httpd_resp_send(req, index_html_whole_gz, HTTPD_RESP_USE_STRLEN);
And here's my question: If I cut out <body> part from index.html and save it in another file, can I compress them separately and send them to browser? Because JS and CSS part is common for all html files I would save enormous amount of Flash space. If that appoach is correct which functions should I use? Thanks!