FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(envd): serve actual content for procfs/sysfs files with size=0 by dajiaohuang · Pull Request #3664 · e2b-dev/runtime · GitHub

Repository navigation

fix(envd): serve actual content for procfs/sysfs files with size=0 - #3664

Open
dajiaohuang wants to merge 1 commit into
e2b-dev:mainfrom
dajiaohuang:fix/procfs-empty-body-size-0
Open

dajiaohuang wants to merge 1 commit into
e2b-dev:mainfrom
dajiaohuang:fix/procfs-empty-body-size-0

Conversation

Copy link
Copy Markdown

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

  • The existing test suite does not cover procfs/sysfs virtual files with size=0
  • A regression test should be added for this specific case

Related issue

Fixes #3363

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

cla-bot Bot commented Sep 25, 2026

Copy link
Copy Markdown

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'

This branch has not been deployed

No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

envd: GET /files returns an empty body for procfs/sysfs files unless gzip is negotiated

1 participant


Back | FazBrowse Home | New Git URL