Skip to content

Get raw headers from request #141

Description

@alandipert

Currently, callback functions registered via call or onHeaders can only receive the "Rook-style" request headers ("HTTP_ Variables" in the Rook README).

It would be useful if there was a way to receive the raw headers, before they were munged to become variable names, perhaps as a list of pairs of strings. That way, headers could be inspected without accounting for Rook's renaming of them.

Interested parties so far include @wch and @jeroen.

This capability raises various questions.

Questions

  1. What value should be used to represent raw headers?
    1. Shouldn't be an env because the same header might appear multiple times. This is valid in HTTP under certain circumstances
  2. How should a handler be registered so that httpuv knows to pass it raw headers? And, how should that value be passed? Possibilities include:
    1. New callRaw and onHeadersRaw app members that pass the handler a second argument, the raw headers value. Using in conjunction with call/onHeaders respectively is an error.
    2. Always add the raw headers as an attribute of the Rook req object passed to call/onHeaders
      1. Problematic because attributes can contribute to object equality. Might not be backward-compatible?
      2. Introduces overhead we don't want to pay all the time?
    3. Add an addRawRequest = TRUE (default FALSE) member to app. This would be the only member of app so far that's not a function. Causes raw header value to be added to all reqs as an attribute.
    4. Like above, but add the addRawRequest = TRUE optional argument to startServer/startPipeServer instead of as app member.
    5. Add req$headers
      1. Should this be an addition to Rook first, then httpuv?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions