| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
When stat.Size() returns 0 for virtual files like procfs/sysfs, http.ServeContent uses seek to determine size and sets Content-Length: 0, causing empty responses. The gzip path works because io.Copy streams content directly without seeking. Fix by reading size=0 files into memory (capped at 64 KiB) and serving via bytes.Reader through http.ServeContent, preserving Range/conditional request semantics while returning actual content. Fixes e2b-dev#3363
|
We require contributors to sign our Contributor License Agreement, and we don't have @dajiaohuang on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check' |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
When stat.Size() returns 0 for virtual files like procfs/sysfs (e.g., /proc/sys/kernel/random/boot_id), http.ServeContent uses seek to determine size and sets Content-Length: 0, causing empty responses. The gzip path works because io.Copy streams content directly without seeking.
Fix
Read size=0 files into memory (capped at 64 KiB) and serve via bytes.Reader through http.ServeContent, preserving Range/conditional request semantics while returning actual content.
Testing
Related issue
Fixes #3363