From: Ben Darnell Date: Thu, 24 Jul 2014 02:24:04 +0000 (-0400) Subject: Cite RFC 2730 when stripping extraneous line breaks. X-Git-Tag: v4.1.0b1~127 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af463164a4b75b7623e4c8ee116dfef0d3f9b4dc;p=thirdparty%2Ftornado.git Cite RFC 2730 when stripping extraneous line breaks. --- diff --git a/tornado/http1connection.py b/tornado/http1connection.py index 0a6d87c10..1e8196f8e 100644 --- a/tornado/http1connection.py +++ b/tornado/http1connection.py @@ -471,6 +471,10 @@ class HTTP1Connection(httputil.HTTPConnection): self._finish_future.set_result(None) def _parse_headers(self, data): + # The lstrip removes newlines that some implementations sometimes + # insert between messages of a reused connection. Per RFC 7230, + # we SHOULD ignore at least one empty line before the request. + # http://tools.ietf.org/html/rfc7230#section-3.5 data = native_str(data.decode('latin1')).lstrip("\r\n") eol = data.find("\r\n") start_line = data[:eol]