{"action":"created","issue":{"url":"https://api.github.com/repos/rstudio/httpuv/issues/141","repository_url":"https://api.github.com/repos/rstudio/httpuv","labels_url":"https://api.github.com/repos/rstudio/httpuv/issues/141/labels{/name}","comments_url":"https://api.github.com/repos/rstudio/httpuv/issues/141/comments","events_url":"https://api.github.com/repos/rstudio/httpuv/issues/141/events","html_url":"https://github.com/rstudio/httpuv/issues/141","id":326231412,"number":141,"title":"Get raw headers from request","user":{"login":"alandipert","id":26024,"avatar_url":"https://avatars0.githubusercontent.com/u/26024?v=4","gravatar_id":"","url":"https://api.github.com/users/alandipert","html_url":"https://github.com/alandipert","followers_url":"https://api.github.com/users/alandipert/followers","following_url":"https://api.github.com/users/alandipert/following{/other_user}","gists_url":"https://api.github.com/users/alandipert/gists{/gist_id}","starred_url":"https://api.github.com/users/alandipert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alandipert/subscriptions","organizations_url":"https://api.github.com/users/alandipert/orgs","repos_url":"https://api.github.com/users/alandipert/repos","events_url":"https://api.github.com/users/alandipert/events{/privacy}","received_events_url":"https://api.github.com/users/alandipert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"alandipert","id":26024,"avatar_url":"https://avatars0.githubusercontent.com/u/26024?v=4","gravatar_id":"","url":"https://api.github.com/users/alandipert","html_url":"https://github.com/alandipert","followers_url":"https://api.github.com/users/alandipert/followers","following_url":"https://api.github.com/users/alandipert/following{/other_user}","gists_url":"https://api.github.com/users/alandipert/gists{/gist_id}","starred_url":"https://api.github.com/users/alandipert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alandipert/subscriptions","organizations_url":"https://api.github.com/users/alandipert/orgs","repos_url":"https://api.github.com/users/alandipert/repos","events_url":"https://api.github.com/users/alandipert/events{/privacy}","received_events_url":"https://api.github.com/users/alandipert/received_events","type":"User","site_admin":false},"assignees":[{"login":"alandipert","id":26024,"avatar_url":"https://avatars0.githubusercontent.com/u/26024?v=4","gravatar_id":"","url":"https://api.github.com/users/alandipert","html_url":"https://github.com/alandipert","followers_url":"https://api.github.com/users/alandipert/followers","following_url":"https://api.github.com/users/alandipert/following{/other_user}","gists_url":"https://api.github.com/users/alandipert/gists{/gist_id}","starred_url":"https://api.github.com/users/alandipert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alandipert/subscriptions","organizations_url":"https://api.github.com/users/alandipert/orgs","repos_url":"https://api.github.com/users/alandipert/repos","events_url":"https://api.github.com/users/alandipert/events{/privacy}","received_events_url":"https://api.github.com/users/alandipert/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-05-24T18:05:11Z","updated_at":"2018-05-24T21:27:25Z","closed_at":null,"author_association":"NONE","body":"Currently, callback functions registered via `call` or `onHeaders` can only receive the \"Rook-style\" request headers (\"HTTP_ Variables\" in the [Rook README](https://github.com/jeffreyhorner/Rook)).\r\n\r\nIt 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.\r\n\r\nInterested parties so far include @wch and @jeroen.\r\n\r\nThis capability raises various questions.\r\n\r\n## Questions\r\n\r\n1. What value should be used to represent raw headers?\r\n    1. Shouldn't be an `env` because the same header might appear multiple times. This is valid in HTTP under [certain circumstances](https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2)\r\n1. How should a handler be registered so that httpuv knows to pass it raw headers? And, how should that value be passed? Possibilities include:\r\n    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.\r\n    2. Always add the raw headers as an attribute of the Rook `req` object passed to `call`/`onHeaders`\r\n        1. Problematic because attributes can contribute to object equality. Might not be backward-compatible?\r\n        1. Introduces overhead we don't want to pay all the time?\r\n    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 `req`s as an attribute.\r\n    4. Like above, but add the `addRawRequest = TRUE` optional argument to `startServer`/`startPipeServer` instead of as `app` member.\r\n    5. Add `req$headers`\r\n        1. Should this be an addition to Rook first, then httpuv?"},"comment":{"url":"https://api.github.com/repos/rstudio/httpuv/issues/comments/391868682","html_url":"https://github.com/rstudio/httpuv/issues/141#issuecomment-391868682","issue_url":"https://api.github.com/repos/rstudio/httpuv/issues/141","id":391868682,"user":{"login":"alandipert","id":26024,"avatar_url":"https://avatars0.githubusercontent.com/u/26024?v=4","gravatar_id":"","url":"https://api.github.com/users/alandipert","html_url":"https://github.com/alandipert","followers_url":"https://api.github.com/users/alandipert/followers","following_url":"https://api.github.com/users/alandipert/following{/other_user}","gists_url":"https://api.github.com/users/alandipert/gists{/gist_id}","starred_url":"https://api.github.com/users/alandipert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alandipert/subscriptions","organizations_url":"https://api.github.com/users/alandipert/orgs","repos_url":"https://api.github.com/users/alandipert/repos","events_url":"https://api.github.com/users/alandipert/events{/privacy}","received_events_url":"https://api.github.com/users/alandipert/received_events","type":"User","site_admin":false},"created_at":"2018-05-24T21:27:25Z","updated_at":"2018-05-24T21:27:25Z","author_association":"NONE","body":"@wch and I took a first cut at an implementation: https://github.com/rstudio/httpuv/commit/395d5684659d05b29af3f10cb393227276721ab5\r\n\r\nIt adds `HEADERS`, a named character vector, to the Rook request env.\r\n\r\nWe have some code that uses httpuv as a proxy frontend with a curl backend, and this change would simplify the conversion of Rook requests to parameterized curl handles.\r\n\r\n@jeroen, would it suit your needs as well? We're curious to hear if it would work for you too, or if you otherwise have any feedback."}}
{"actor":{"display_login":"alandipert"}}