Open
Description
Board
any
Device Description
any esp32 device
Hardware Configuration
any configuration using WebServer library
Version
3.1.0 (also on master)
IDE Name
Arduino IDE (any)
Operating System
Linux
Flash frequency
n/a
PSRAM enabled
yes
Upload speed
n/a
Description
Currentl StaticRequestHandler doesn't serve index.htm.gz
file when index.htm
exists.
&& !_fs.exists(path)
prevents gz content to be served: when both compressed and uncompressed versions of same file are present, the uncompressed version is served.
Moreover, StaticRequestHandler::handle()
completely ignores the 'Accept-Encoding' header sent by the client, which should be checked for gzip
and/or deflate
before deciding if it is worth looking for a compressed version of the file.
Sketch
server.serveStatic("/", LittleFS, "/");
Debug Message
filesystem contents:
File: /index.htm 29878 bytes
File: /index.htm.gz 13698 bytes
current behaviour:
$ curl -I -H 'Accept-Encoding: gzip,deflate' http://192.168.1.13
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 29878
Connection: close
expected behaviour:
$ curl -I -H 'Accept-Encoding: ' http://192.168.1.13
HTTP/1.1 200 OK
Content-Type: text/html
Content-Encoding: gzip
Content-Length: 13698
Connection: close
other expected behaviour (no accept-encoding headers):
$ curl -I http://192.168.1.13
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 29878
Connection: close
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.
Metadata
Metadata
Assignees
Type
Projects
Status
Todo