Feature request: serve pre-compressed static files (`gzip_static`)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 56/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- c
- 领域
- backend, performance
调研方向
首先跟踪 uhttpd 的静态文件请求路径,以及它对 Accept-Encoding 和 Content-Type 的处理。仅当接受 gzip 时才实现选择同名 .gz 文件,保留原始文件的类型,并验证未压缩文件的提供方式保持不变。
由索引模型根据 Issue 内容生成。
描述
Summary
Please consider adding static pre-compressed file serving to uhttpd: when a request for foo.css arrives with Accept-Encoding: gzip and a sibling file foo.css.gz exists on disk, serve the .gz bytes verbatim with Content-Encoding: gzip and the original file's Content-Type.
This is not on-the-fly (dynamic) compression. It simply hands back an already-compressed file that the developer/build system produced ahead of time. Request-time CPU cost is therefore lower than serving the uncompressed file (fewer bytes pushed through the network stack), not higher — which keeps it in line with uhttpd's goal of being a minimal, low-overhead server for constrained devices.
Use case
I'm developing a modern LuCI theme. It's built with Tailwind CSS, which — even after tree-shaking and minification — emits a fairly large stylesheet because of the volume of utility classes and generated custom properties the design relies on. The result is highly repetitive text, which is close to the ideal case for gzip.
Measured on my theme's production build:
| File | Raw (bytes) | gzip -9 (bytes) | Saving |
|---|---|---|---|
| main.css | 211,725 | 27,808 | −87% |
| login.css | 30,498 | 6,604 | −78% |
| menu-aurora.js | 17,348 | 4,604 | −73% |
Shipping the .gz sibling would cut the transfer size of these assets by roughly an order of magnitude, with no added request-time cost to the router.
- 主要语言
- C
- 星标
- 39
- 派生
- 31
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
openwrt/uhttpd 的其他 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
FujiNetWIFI/fujinet-config#379 ·
维护者通常 1 天内回复
-
Ship /Local/Applications, the Local domain's Applications folder可能已有人在做 @pkgdemon 今天认领。 未关闭area:base enhancement
难度 1/5 1 小时以内 新手友好度 94/100
nextbsd/nextbsd-userland#612 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
zephyrproject-rtos/zephyr#125543 ·
维护者通常 2 天内回复
-
good first issue needs-triage
难度 1/5 1 小时以内 新手友好度 88/100
InauguralSystems/EigenScript#2347 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
colbymchenry/codegraph#3277 ·
维护者通常 1 天内回复