{"action":"closed","issue":{"url":"https://api.github.com/repos/kennethreitz/requests/issues/3098","repository_url":"https://api.github.com/repos/kennethreitz/requests","labels_url":"https://api.github.com/repos/kennethreitz/requests/issues/3098/labels{/name}","comments_url":"https://api.github.com/repos/kennethreitz/requests/issues/3098/comments","events_url":"https://api.github.com/repos/kennethreitz/requests/issues/3098/events","html_url":"https://github.com/kennethreitz/requests/issues/3098","id":148578221,"number":3098,"title":"HeaderParsingError: Failed to parse headers","user":{"login":"guyskk","id":6367792,"avatar_url":"https://avatars.githubusercontent.com/u/6367792?v=3","gravatar_id":"","url":"https://api.github.com/users/guyskk","html_url":"https://github.com/guyskk","followers_url":"https://api.github.com/users/guyskk/followers","following_url":"https://api.github.com/users/guyskk/following{/other_user}","gists_url":"https://api.github.com/users/guyskk/gists{/gist_id}","starred_url":"https://api.github.com/users/guyskk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guyskk/subscriptions","organizations_url":"https://api.github.com/users/guyskk/orgs","repos_url":"https://api.github.com/users/guyskk/repos","events_url":"https://api.github.com/users/guyskk/events{/privacy}","received_events_url":"https://api.github.com/users/guyskk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-15T07:22:15Z","updated_at":"2016-04-15T08:12:58Z","closed_at":"2016-04-15T08:12:58Z","body":"```\r\nINFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1\r\nDEBUG:requests.packages.urllib3.connectionpool:\"POST /kkblog/ HTTP/1.1\" 201 None\r\nWARNING:requests.packages.urllib3.connectionpool:Failed to parse headers (url=http://127.0.0.1:5984/kkblog/): [MissingHeaderBodySeparatorDefect()], unparsed data: '³é\\x97\\xad\\r\\nETag: \"1-967a00dff5e02add41819138abb3284d\"\\r\\nDate: Fri, 15 Apr 2016 14:45:18 GMT\\r\\nContent-Type: text/plain; charset=utf-8\\r\\nContent-Length: 69\\r\\nCache-Control: must-revalidate\\r\\n\\r\\n'\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py\", line 390, in _make_request\r\n    assert_header_parsing(httplib_response.msg)\r\n  File \"/usr/lib/python3.5/site-packages/requests/packages/urllib3/util/response.py\", line 59, in assert_header_parsing\r\n    raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data)\r\nrequests.packages.urllib3.exceptions.HeaderParsingError: [MissingHeaderBodySeparatorDefect()], unparsed data: '³é\\x97\\xad\\r\\nETag: \"1-967a00dff5e02add41819138abb3284d\"\\r\\nDate: Fri, 15 Apr 2016 14:45:18 GMT\\r\\nContent-Type: text/plain; charset=utf-8\\r\\nContent-Length: 69\\r\\nCache-Control: must-revalidate\\r\\n\\r\\n'\r\n```\r\n\r\nhere is the same request with curl:\r\n\r\n```\r\ncurl -v -X POST 127.0.0.1:5984/kkblog/ -H \"Content-Type: application/json\" -d '{\"_id\": \"关闭\"}'\r\nNote: Unnecessary use of -X or --request, POST is already inferred.\r\n*   Trying 127.0.0.1...\r\n* Connected to 127.0.0.1 (127.0.0.1) port 5984 (#0)\r\n> POST /kkblog/ HTTP/1.1\r\n> Host: 127.0.0.1:5984\r\n> User-Agent: curl/7.47.1\r\n> Accept: */*\r\n> Content-Type: application/json\r\n> Content-Length: 17\r\n> \r\n* upload completely sent off: 17 out of 17 bytes\r\n< HTTP/1.1 201 Created\r\n< Server: CouchDB/1.6.1 (Erlang OTP/18)\r\n< Location: http://127.0.0.1:5984/kkblog/关闭\r\n< ETag: \"3-bc27b6930ca514527d8954c7c43e6a09\"\r\n< Date: Fri, 15 Apr 2016 15:13:14 GMT\r\n< Content-Type: text/plain; charset=utf-8\r\n< Content-Length: 69\r\n< Cache-Control: must-revalidate\r\n< \r\n{\"ok\":true,\"id\":\"关闭\",\"rev\":\"3-bc27b6930ca514527d8954c7c43e6a09\"}\r\n* Connection #0 to host 127.0.0.1 left intact\r\n```\r\n\r\nthe problem is `Location: http://127.0.0.1:5984/kkblog/关闭` in the response header, I tried other Chinese chars but they didn't cause Exception.\r\n\r\n```\r\n>>> '关闭'.encode('utf-8')\r\nb'\\xe5\\x85\\xb3\\xe9\\x97\\xad'\r\n>>> \r\n```"}}