From 5a63884eca9b8f7290b2dfb5b83e099ea9b30b2c Mon Sep 17 00:00:00 2001 From: lustre Date: Sun, 24 Jul 2022 16:34:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=91=E8=A1=8C=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 03a2cc7..2c8a5af 100644 --- a/readme.md +++ b/readme.md @@ -17,9 +17,22 @@ const uint8_t index_html_gz[] = { 以下使用 `esp_http_server.h`。设置http响应头`Content-Encoding` 中压缩格式,让浏览器按gzip格式解压 +esp32系列按以下方式 + ```cpp httpd_resp_set_type(req, "text/html"); httpd_resp_set_hdr(req, "Content-Encoding", "gzip"); ``` -[点此下载](https://gitcode.net/org.btik/html_cutdown/-/archive/1.0beta/html_cutdown-1.0beta.zip) \ No newline at end of file +esp8266按以下方式 + +```cpp + ESP8266WebServer server(80); +// ... 省略中间 + server.sendHeader("Content-Encoding", "gzip"); + server.send(200, "text/html", index_html_gz, index_html_len); +``` + + + +[点此下载](https://gitcode.net/org.btik/html_cutdown/uploads/19a4a945e43633e88dd5404789506413/htmlCutDown.zip) \ No newline at end of file -- GitLab