Skip to content

docs: request strings are views of the receive buffer on the native engines; RequestHeaders is not a copy (Refs celeris#891) - #115

Draft
FumingPower3925 wants to merge 1 commit into
mainfrom
fix/891-request-string-lifetime
Draft

FumingPower3925 wants to merge 1 commit into
mainfrom
fix/891-request-string-lifetime

Conversation

@FumingPower3925

Copy link
Copy Markdown
Contributor

What

Three docs pages (request-handling.md, core-concepts.md, context-api-reference.md) now say what the request strings are. Docs repo change; no celeris code.

  • RequestHeaders() is not a safe-to-retain copy. It is the request's own header slice on HTTP/1.1 (a copy on HTTP/2), read-only, valid until the handler returns. The names and values are views of the receive buffer on the native engines over HTTP/1.1.
  • Every request string (Param, Header, Path, Method, Query, ...) is a view of the receive buffer on the Epoll, IOUring and Adaptive engines over HTTP/1.1. x := c.Param("id") is the same view, not a copy; strings.Clone is the copy. The engine reuses that buffer for the connection's next request and, once the connection closes, for another connection.
  • Detach copies the values the Context holds, not the strings you already read out of it (on HTTP/2 it copies neither the headers nor the body). After Hijack (HTTP/1.1 only) the request strings stay valid, including the ones read before the call.
  • On every engine the contract is the same: valid until the handler returns.

Why

The pages called RequestHeaders() a safe copy, said x := c.Param("id") copies, and named only Body() and Header() as views. That follows an older comment in celeris, and code written from the docs could keep a string that later reads another client's request.

The pages quote celeris source (RequestHeaders, doc.go). Those quotes match celeris main, not the v1.5.11 tag, so this should land with v1.6.0. Plan: open it as a draft, add it to the celeris#649 checklist beside the triage row for the Detach wording, and after the tag re-check the quotes against git show v1.6.0:context_request.go and v1.6.0:doc.go.

Tests

On the docs repo: bun test 29 pass, bun run validate, bun run build and bun run check (0 errors, 0 warnings) all pass. No wording-guard test is added here: the scripts/kernel-floor.test.ts pattern that was suggested is in #108 and not on docs main yet.

Risk

Docs only. The branch is based on docs main (7f76e18) and applies cleanly on main; it does not need #108 or #113 and should not be stacked on them.

Refs celeris#891

…ngines; RequestHeaders is not a copy (Refs celeris#891)

request-handling.md, core-concepts.md and context-api-reference.md called
RequestHeaders() a safe-to-retain copy, said x := c.Param("id") copies, and
named only Body() and Header() as views. Per celeris doc.go (celeris#920): every
request string is a view of the receive buffer on epoll, io_uring and Adaptive
over HTTP/1.1, valid until the handler returns; copy with strings.Clone.
After Hijack (HTTP/1.1 only) the request strings stay valid, including those
read before the call; Detach copies the values the Context holds but not the
strings you already read out of it.
@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
goceleris-docs b8b2790 Commit Preview URL

Branch Preview URL
Nov 10 2026, 06:21 PM

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.

1 participant