R. David Murray added the comment:

Since the email package has the correct logic for handling the blank 
continuation line case (even in Python2) (because, again, that derives from the 
original email standard), it might be reasonable to use feedparser's 
headersonly mode.  If necessary we can introduce a (private) variation that 
actually stops parsing the stream at the end of the headers.  (This would be a 
non-public API on feedparser for 2.7 and 3.4/5, and a public one in 3.6.)  
Since feedparser was itself a rewrite of the mimetools code httplib is using 
and theoretically backward compatible with it in behavior, this should not in 
theory introduce any behavior changes (famous last words?).  

The problem here is the good chance that someone is depending on the internal 
implementation of HTTPMessage.  So, I'm not at all sure about this suggestion.
 
And yes, the email package in python3 records header defects.  However, I think 
it is better to treat the no-leading-blank non-header as an incorrectly folded 
continuation line rather than discarding the data.  The data is in the headers 
section for *some* reason, and IMO that is the only reasonable guess as to why.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24363>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to