From f53532a92e46e11309d338a65ae2a4ddfd32dca4 Mon Sep 17 00:00:00 2001 From: benoitc Date: Fri, 12 Mar 2010 14:15:21 +0100 Subject: [PATCH] always use TeeInput --- gunicorn/http/request.py | 7 ++++--- gunicorn/http/tee.py | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gunicorn/http/request.py b/gunicorn/http/request.py index 29f610ed..6e0efdc8 100644 --- a/gunicorn/http/request.py +++ b/gunicorn/http/request.py @@ -70,8 +70,8 @@ class Request(object): buf.write(data) buf2 = self.parser.filter_headers(headers, buf) if buf2: - break - + break + self.log.debug("%s", self.parser.status) self.log.debug("Headers:\n%s" % headers) @@ -79,7 +79,8 @@ class Request(object): self._sock.send("HTTP/1.1 100 Continue\r\n\r\n") if not self.parser.content_len and not self.parser.is_chunked: - wsgi_input = StringIO() + wsgi_input = TeeInput(self._sock, self.parser, StringIO(), + self.conf) content_length = "0" else: wsgi_input = TeeInput(self._sock, self.parser, buf2, self.conf) diff --git a/gunicorn/http/tee.py b/gunicorn/http/tee.py index f74eedbd..c341a9c1 100644 --- a/gunicorn/http/tee.py +++ b/gunicorn/http/tee.py @@ -148,7 +148,10 @@ class TeeInput(object): __next__ = next def __iter__(self): - return self + return self + + def get_socket(self): + return self._sock.dup() def _tee(self, length): """ fetch partial body"""