[issue24363] httplib fails to handle semivalid HTTP headers

Martin Panter report at bugs.python.org
Fri Aug 12 08:37:54 EDT 2016


Martin Panter added the comment:

In order to avoid messing too much with the intricacies of the existing email parsing, here is a patch for Python 3 that limits the behaviour changes to the HTTP module. It should fix the bad handling of broken header lines. As a side effect, it should also fix Issue 22233, since it bypasses the offending splitlines() call. I incorporated the test cases from my previous patches for Issue 26686 and Issue 22233.

I tried to maintain a minimal compatibility with the previous special behaviour for message/* and multipart/* message types, although I didn’t bother trying to emulate e.g. StartBoundaryNotFoundDefect (http.client.parse_headers() doesn’t pass any body to the email parser, so it won’t see any start boundaries.)

----------
dependencies:  -email.parser stops parsing headers too soon when given a defective message.
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file44087/bypass-parsegen.patch

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


More information about the Python-bugs-list mailing list