From b9fe01ca2cf80ccefdbc298741fd9f822ab1d757 Mon Sep 17 00:00:00 2001 From: George Notaras Date: Thu, 19 Dec 2013 03:18:18 +0200 Subject: [PATCH] Fixed the request line length check. --- gunicorn/http/message.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gunicorn/http/message.py b/gunicorn/http/message.py index a82ba5a8..8be1f70b 100644 --- a/gunicorn/http/message.py +++ b/gunicorn/http/message.py @@ -213,12 +213,11 @@ class Request(Message): if idx > limit > 0: raise LimitRequestLine(idx, limit) break + elif len(data) - 2 > limit > 0: + raise LimitRequestLine(len(data), limit) self.get_data(unreader, buf) data = buf.getvalue() - if len(data) - 2 > limit > 0: - raise LimitRequestLine(len(data), limit) - return (data[:idx], # request line, data[idx + 2:]) # residue in the buffer, skip \r\n