From d21254edfcf614039201e1e5902b18b17b0ea323 Mon Sep 17 00:00:00 2001 From: benoitc Date: Sat, 13 Mar 2010 23:21:42 +0100 Subject: [PATCH] update readme --- examples/gunicorn.conf.py.sample | 20 -------------------- gunicorn/arbiter.py | 2 +- gunicorn/http/request.py | 2 ++ gunicorn/http/tee.py | 4 +++- gunicorn/sock.py | 2 +- 5 files changed, 7 insertions(+), 23 deletions(-) delete mode 100644 examples/gunicorn.conf.py.sample diff --git a/examples/gunicorn.conf.py.sample b/examples/gunicorn.conf.py.sample deleted file mode 100644 index 3f41a71a..00000000 --- a/examples/gunicorn.conf.py.sample +++ /dev/null @@ -1,20 +0,0 @@ -bind='unix:/tmp/gunicorn.sock', -daemon=True, -debug=False, -logfile='/var/log/gunicorn.log', -loglevel='info', -pidfile='/var/run/gunicorn.pid', -workers=1, -umask=0, - -# for systems with nobody and no group -user="nobody", -group="nogroup", - -after_fork=lambda server, worker: server.log.info( - "worker=%s spawned pid=%s" % (worker.id, str(worker.pid))), - -before_fork=lambda server, worker: server.log.info( - "worker=%s spawning" % worker.id), - -before_exec=lambda server: server.log.info("forked child, reexecuting") \ No newline at end of file diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 14b83669..11da6fdb 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -412,5 +412,5 @@ class Arbiter(object): worker.tmp.close() os.unlink(worker.tmpname) except (KeyError, OSError): - pass + return raise diff --git a/gunicorn/http/request.py b/gunicorn/http/request.py index 6e0efdc8..55c1f4eb 100644 --- a/gunicorn/http/request.py +++ b/gunicorn/http/request.py @@ -74,6 +74,8 @@ class Request(object): self.log.debug("%s", self.parser.status) self.log.debug("Headers:\n%s" % headers) + if not headers: + return if self.parser.headers_dict.get('Expect','').lower() == "100-continue": self._sock.send("HTTP/1.1 100 Continue\r\n\r\n") diff --git a/gunicorn/http/tee.py b/gunicorn/http/tee.py index c341a9c1..d067ad25 100644 --- a/gunicorn/http/tee.py +++ b/gunicorn/http/tee.py @@ -34,7 +34,9 @@ class TeeInput(object): self._is_socket = True self._len = parser.content_len - if self._len and self._len < util.MAX_BODY: + if not self.parser.content_len and not self.parser.is_chunked: + self.tmp = StringIO() + elif self._len and self._len < util.MAX_BODY: self.tmp = StringIO() else: self.tmp = tempfile.TemporaryFile(dir=self.conf['tmp_upload_dir']) diff --git a/gunicorn/sock.py b/gunicorn/sock.py index 4b4bb5e4..c5662376 100644 --- a/gunicorn/sock.py +++ b/gunicorn/sock.py @@ -33,9 +33,9 @@ class BaseSocket(object): def set_options(self, sock, bound=False): sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + sock.setblocking(0) if not bound: self.bind(sock) - sock.setblocking(0) sock.listen(self.conf['backlog']) return sock