Skip to content

Commit da3fb09

Browse files
author
ficeto
committed
add gzip content support for HTML File streaming
1 parent dcb1a0e commit da3fb09

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h

+7
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ template<typename T> size_t streamFile(T &file, String contentType){
8888
head += file.size();
8989
head += "\r\nConnection: close";
9090
head += "\r\nAccess-Control-Allow-Origin: *";
91+
if(
92+
String(file.name()).endsWith(".gz") &&
93+
contentType != "application/x-gzip" &&
94+
contentType != "application/octet-stream"
95+
){
96+
head += "\r\nContent-Encoding: gzip";
97+
}
9198
head += "\r\n\r\n";
9299
_currentClient.print(head);
93100
head = String();

0 commit comments

Comments
 (0)