Martin Panter added the comment: HTTP header fields are not supposed to have line breaks unless followed by a space or tab. So the server is actually providing a faulty response.
However Python could do better at handling this case. There is already a bug open for this: Issue 24363. For the record, the full server response I get is: 'HTTP/1.1 200 OK\r\n' 'Server: nginx\r\n' 'Date: Sat, 11 Jun 2016 14:47:19 GMT\r\n' 'Content-Type: text/plain\r\n' 'Transfer-Encoding: chunked\r\n' 'Connection: close\r\n' 'Vary: Accept-Encoding\r\n' 'Strict-Transport-Security: max-age=15768000; includeSubDomains; preload\r\n' 'Public-Key-Pins: \n' 'pin-sha256="306cc4Cc2py0x48ZiX2G5vt5OxF9afmouqccrFqb8Jc=";\n' 'pin-sha256="dWkVtg0EuckExnceVFvu3tuEApEygbxr2FPTlpHAUrQ=";\n' 'pin-sha256="DjjVxb2/6kxfX8qyP2TE/j8B0tOB60MhTTvJdNsFPaU=";\n' 'max-age=5184000; includeSubDomains;\n' 'report-uri="https://rugkdyndns.report-uri.io/r/default/hpkp/enforce"\r\n' '\r\n' '28\r\n' 'Bug: https://bugs.python.org/issue27296\n' '\r\n' '0\r\n' '\r\n' ---------- nosy: +martin.panter resolution: -> duplicate status: open -> closed superseder: -> httplib fails to handle semivalid HTTP headers _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27296> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com