From fa55292828d961369c93fb89293f0d18ec4f0e5d Mon Sep 17 00:00:00 2001 From: Pavel Fux Date: Sun, 8 May 2016 11:15:23 +0300 Subject: [PATCH] BUG: Not handaling correctly if the header termination is \n\n and not \r\n\r\n From RFC2616 section 19.3 Tolerant Applications: The line terminator for message-header fields is the sequence CRLF. However, we recommend that applications, when parsing such headers, recognize a single LF as a line terminator and ignore the leading CR. --- http_parser/pyparser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/http_parser/pyparser.py b/http_parser/pyparser.py index 835ca34d..2775076c 100644 --- a/http_parser/pyparser.py +++ b/http_parser/pyparser.py @@ -323,6 +323,8 @@ def _parse_request_line(self, line): def _parse_headers(self, data): idx = data.find(b("\r\n\r\n")) + if idx < 0: + idx = data.find(b("\n\n")) if idx < 0: # we don't have all headers return False