[issue24363] httplib fails to handle semivalid HTTP headers

R. David Murray report at bugs.python.org
Tue Jun 2 18:28:01 CEST 2015


R. David Murray added the comment:

Ah, in fact that's exactly where it comes from, since httplib uses the email header parsing code.  In python3 we are actually using the email package to parse the headers (which is sensible) (in 2.7 it is a copy of code from the old mimelib with some tweaks).  Fixing this in python3 is best done by making the error recovery enhancement(s) I mentioned in the email package.  

Please note that changing this behavior has the potential to break working code.  That is, just as we have here a server that is out of spec and sending invalid links in the middle of headers, we may have a server that is out of spec by not sending the blank delimiter, which is currently being handled "correctly".  Thus I don't think your simple fix is advisable, instead I think we should pursue the more complicated "look ahead" fix.

----------
versions:  -Python 3.3

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


More information about the Python-bugs-list mailing list