{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-plug/plug/issues/571","repository_url":"https://api.github.com/repos/elixir-plug/plug","labels_url":"https://api.github.com/repos/elixir-plug/plug/issues/571/labels{/name}","comments_url":"https://api.github.com/repos/elixir-plug/plug/issues/571/comments","events_url":"https://api.github.com/repos/elixir-plug/plug/issues/571/events","html_url":"https://github.com/elixir-plug/plug/pull/571","id":244072102,"number":571,"title":"Fixing cowboy headers overriding from plug","user":{"login":"zloyrusskiy","id":119313,"avatar_url":"https://avatars1.githubusercontent.com/u/119313?v=4","gravatar_id":"","url":"https://api.github.com/users/zloyrusskiy","html_url":"https://github.com/zloyrusskiy","followers_url":"https://api.github.com/users/zloyrusskiy/followers","following_url":"https://api.github.com/users/zloyrusskiy/following{/other_user}","gists_url":"https://api.github.com/users/zloyrusskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/zloyrusskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zloyrusskiy/subscriptions","organizations_url":"https://api.github.com/users/zloyrusskiy/orgs","repos_url":"https://api.github.com/users/zloyrusskiy/repos","events_url":"https://api.github.com/users/zloyrusskiy/events{/privacy}","received_events_url":"https://api.github.com/users/zloyrusskiy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-19T15:01:41Z","updated_at":"2017-07-19T15:36:44Z","closed_at":"2017-07-19T15:36:44Z","pull_request":{"url":"https://api.github.com/repos/elixir-plug/plug/pulls/571","html_url":"https://github.com/elixir-plug/plug/pull/571","diff_url":"https://github.com/elixir-plug/plug/pull/571.diff","patch_url":"https://github.com/elixir-plug/plug/pull/571.patch"},"body":"My colleague found that setting headers for connection in capitalized case has wrong effect rather than down-cased version.\r\n\r\nWhen we set \"Server\" header like this:\r\n`\r\n  conn |> put_resp_header(\"Server\", \"myserver\")\r\n`\r\n\r\nwe get two headers at response:\r\nserver: Cowboy\r\nserver: myserver\r\n\r\nWhen we set \"Server\" header like that:\r\n`\r\n  conn |> put_resp_header(\"server\", \"myserver\")\r\n`\r\n\r\nwe get only one:\r\nserver: myserver\r\n\r\nThis inconsistency appears because of the fact that cowboy operates only with lowercase header names. It's described in [their guide](https://ninenines.eu/docs/en/cowboy/1.0/guide/broken_clients/#lowercase_headers) and authors of cowboy [refer to RFC 7540](https://github.com/ninenines/cowboy/issues/824)\r\n\r\n> Just as in HTTP/1.x, header field names are strings of ASCII\r\n   characters that are compared in a case-insensitive fashion.  However,\r\n   header field names MUST be converted to lowercase prior to their\r\n   encoding in HTTP/2.  A request or response containing uppercase\r\n   header field names MUST be treated as malformed\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/elixir-plug/plug/issues/comments/316426583","html_url":"https://github.com/elixir-plug/plug/pull/571#issuecomment-316426583","issue_url":"https://api.github.com/repos/elixir-plug/plug/issues/571","id":316426583,"user":{"login":"josevalim","id":9582,"avatar_url":"https://avatars0.githubusercontent.com/u/9582?v=4","gravatar_id":"","url":"https://api.github.com/users/josevalim","html_url":"https://github.com/josevalim","followers_url":"https://api.github.com/users/josevalim/followers","following_url":"https://api.github.com/users/josevalim/following{/other_user}","gists_url":"https://api.github.com/users/josevalim/gists{/gist_id}","starred_url":"https://api.github.com/users/josevalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josevalim/subscriptions","organizations_url":"https://api.github.com/users/josevalim/orgs","repos_url":"https://api.github.com/users/josevalim/repos","events_url":"https://api.github.com/users/josevalim/events{/privacy}","received_events_url":"https://api.github.com/users/josevalim/received_events","type":"User","site_admin":false},"created_at":"2017-07-19T15:36:44Z","updated_at":"2017-07-19T15:36:44Z","body":"Thank you for the report. Plug also expects lower case headers and we even check they are lower cased during tests by default. That's preferred to downcasing on every response, which would be quite expensive. And it also guarantees Plug will work as expected when it comes to http2.\r\n\r\n"}}
{"actor":{"display_login":"josevalim"}}