[New-bugs-announce] [issue22233] http.client splits headers on none-\r\n characters

Samuel Charron report at bugs.python.org
Wed Aug 20 12:02:33 CEST 2014


New submission from Samuel Charron:

In some cases, the headers from http.client (that uses email.feedparser) splits headers at wrong separators. The bug is from the use of str.splitlines (in email.feedparser) that splits on other characters than \r\n as it should. (See bug http://bugs.python.org/issue22232)

To reproduce the bug : 

import http.client
c = http.client.HTTPSConnection("graph.facebook.com")
c.request("GET", "/%C4%85", None, {"test": "\x85"})
r = c.getresponse()
print(r.headers)
print(r.headers.keys())
print(r.headers.get("WWW-Authenticate"))

As you can see, the WWW-Authenticate is wrongly parsed (it misses its final "), and therefore the rest of the headers are ignored.

----------
components: Library (Lib)
messages: 225562
nosy: scharron
priority: normal
severity: normal
status: open
title: http.client splits headers on none-\r\n characters
type: behavior
versions: Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22233>
_______________________________________


More information about the New-bugs-announce mailing list