From 4b478e1a6651f33b36e30294c5a320388ed527f4 Mon Sep 17 00:00:00 2001 From: benoitc Date: Fri, 3 Aug 2012 06:27:26 +0200 Subject: [PATCH] fix request line check. close #390 We never had the possibility to check the limit since we were quitting the loop before it. --- gunicorn/http/message.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gunicorn/http/message.py b/gunicorn/http/message.py index e2c75006..d2361ca3 100644 --- a/gunicorn/http/message.py +++ b/gunicorn/http/message.py @@ -165,13 +165,14 @@ class Request(Message): idx = data.find("\r\n") if idx >= 0: break - - if len(data) - 2 > self.limit_request_line > 0: - raise LimitRequestLine(len(data), self.limit_request_line) - self.get_data(unreader, buf) data = buf.getvalue() + # check if the request line is too large + if len(data) - 2 > self.limit_request_line and \ + self.limit_request_line> 0 : + raise LimitRequestLine(len(data), self.limit_request_line) + self.parse_request_line(data[:idx]) buf = StringIO() buf.write(data[idx+2:]) # Skip \r\n