Skip to content

feat: add Nack::Request - #71

Merged
himura467 merged 1 commit into
mainfrom
feat-request
Nov 1, 2026
Merged

himura467 merged 1 commit into
mainfrom
feat-request

Conversation

@himura467

Copy link
Copy Markdown
Contributor

Closes #16

  • Adds Nack::Request, which wraps any object satisfying SPEC.md section 3 and reads each field lazily, copying a buffer into a frozen String only on first access.
  • Makes request_method, script_name, path_info, query_string, headers and body writable. A nil path or query reads as "", and * stays "*".
  • GET, POST and cookies are cached against the exact object they were parsed from, so replacing query_string, body or a header reparses them. params merges GET and POST on each call.
  • POST reads only an application/x-www-form-urlencoded body, chunk by chunk through body.read, and leaves any other body unread.
  • cookies returns values as sent, without percent-decoding, keeps the first value of a repeated name (RFC 6265 §5.4), and reads a pair without = as a cookie with an empty name (RFC 6265bis).
  • host and port come from authority only, with port falling back to the default for scheme. A malformed authority or a port above 65535 yields nil for both.
  • Names the peer accessor remote_address instead of the ip the issue asks for: it returns the transport peer as SPEC.md defines it, including the unix: form, not a client IP behind proxies as Rack's ip does.
  • Passes connection, protocol, authority, content_length, variable, trailers, inform and tunnel through from the bridge, and adds context.
  • Does not parse multipart bodies.

@himura467
himura467 merged commit d7340dd into main Nov 1, 2026
4 checks passed
@himura467
himura467 deleted the feat-request branch November 1, 2026 15:57
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.

Add Nack::Request

1 participant