{"action":"created","issue":{"url":"https://api.github.com/repos/benoitc/gunicorn/issues/1778","repository_url":"https://api.github.com/repos/benoitc/gunicorn","labels_url":"https://api.github.com/repos/benoitc/gunicorn/issues/1778/labels{/name}","comments_url":"https://api.github.com/repos/benoitc/gunicorn/issues/1778/comments","events_url":"https://api.github.com/repos/benoitc/gunicorn/issues/1778/events","html_url":"https://github.com/benoitc/gunicorn/issues/1778","id":321352180,"number":1778,"title":"Encoding headers with ASCII breaks applications expecting them to be encoded in latin-1","user":{"login":"jrast","id":146369,"avatar_url":"https://avatars3.githubusercontent.com/u/146369?v=4","gravatar_id":"","url":"https://api.github.com/users/jrast","html_url":"https://github.com/jrast","followers_url":"https://api.github.com/users/jrast/followers","following_url":"https://api.github.com/users/jrast/following{/other_user}","gists_url":"https://api.github.com/users/jrast/gists{/gist_id}","starred_url":"https://api.github.com/users/jrast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrast/subscriptions","organizations_url":"https://api.github.com/users/jrast/orgs","repos_url":"https://api.github.com/users/jrast/repos","events_url":"https://api.github.com/users/jrast/events{/privacy}","received_events_url":"https://api.github.com/users/jrast/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-05-08T21:24:07Z","updated_at":"2018-05-19T09:18:58Z","closed_at":null,"author_association":"NONE","body":"Applications, like flask, which expect that the headers are using latin-1 encoding as specified in [rfc5987] will break gunicorn because gunicorn uses ASCII encoding.\r\n\r\nIssue #1353 was closed with the comment\r\n> I'm going to close this as it's well documented around the web that HTTP headers should be ASCII, unfortunately.\r\n\r\nwhich is, according to [rfc5987] wrong. Headers should be encoded ISO-8859-1 (aka latin-1). However, a comment in the issue also mentioned commit 5f4ebd2eb2b08783a5fbefe79d09fcb3fc1fbc73, in which the encoding of the headers was switched back from latin-1 to ascii based on a section in [rfc7230] which states that US-ASCII should be used:\r\n\r\n> Historically, HTTP has allowed field content with text in the\r\n   ISO-8859-1 charset [ISO-8859-1], supporting other charsets only\r\n   through use of [RFC2047] encoding.  In practice, most HTTP header\r\n   field values use only a subset of the US-ASCII charset [USASCII].\r\n   Newly defined header fields SHOULD limit their field values to\r\n   US-ASCII octets.  [...]\r\n\r\nNow, I'm not into all this RFC specifications and don't know which is the right way to do it. However, as other applications expect latin-1 as specified in [rfc5987] but gunicorn implements the version given in [rfc7230], it might be worth to discuss this, even if it's just for a clarification on which track gunicorn is.\r\n\r\nRelated Issues in gunicorn:\r\nhttps://github.com/benoitc/gunicorn/issues/1353 : wsgi.py > send_headers: encoding problem.\r\n\r\nRelated Issues in Flask:\r\nhttps://github.com/pallets/flask/issues/2766 : send_file: latin-1 encoding not compatible with gunicorn\r\nhttps://github.com/pallets/flask/pull/2223 : Fix send_file's attachment_filename to work with non-ascii filenames\r\n\r\nRelated RFC:\r\nhttps://tools.ietf.org/html/rfc5987#section-1\r\n\r\n[rfc5987]:https://tools.ietf.org/html/rfc5987#section-1\r\n[rfc7230]:https://tools.ietf.org/html/rfc7230#section-3.2.4"},"comment":{"url":"https://api.github.com/repos/benoitc/gunicorn/issues/comments/390391986","html_url":"https://github.com/benoitc/gunicorn/issues/1778#issuecomment-390391986","issue_url":"https://api.github.com/repos/benoitc/gunicorn/issues/1778","id":390391986,"user":{"login":"berkerpeksag","id":26338,"avatar_url":"https://avatars1.githubusercontent.com/u/26338?v=4","gravatar_id":"","url":"https://api.github.com/users/berkerpeksag","html_url":"https://github.com/berkerpeksag","followers_url":"https://api.github.com/users/berkerpeksag/followers","following_url":"https://api.github.com/users/berkerpeksag/following{/other_user}","gists_url":"https://api.github.com/users/berkerpeksag/gists{/gist_id}","starred_url":"https://api.github.com/users/berkerpeksag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/berkerpeksag/subscriptions","organizations_url":"https://api.github.com/users/berkerpeksag/orgs","repos_url":"https://api.github.com/users/berkerpeksag/repos","events_url":"https://api.github.com/users/berkerpeksag/events{/privacy}","received_events_url":"https://api.github.com/users/berkerpeksag/received_events","type":"User","site_admin":false},"created_at":"2018-05-19T09:18:58Z","updated_at":"2018-05-19T09:18:58Z","author_association":"COLLABORATOR","body":"> I'm inclined towards being tolerant in this case, since it aligns with the PEP and with popular frameworks.\r\n\r\n+1"}}
{"actor":{"display_login":"berkerpeksag"}}