From ff47d224889d213346f3a33b31bb3e56d9150ca2 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Thu, 1 Apr 2010 16:28:09 -0400 Subject: [PATCH] Fix bug when responses have no body. Thanks to Chris Dent for noticing this. --- THANKS | 1 + gunicorn/http/response.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/THANKS b/THANKS index cee470eb..800302f2 100644 --- a/THANKS +++ b/THANKS @@ -9,3 +9,4 @@ Eric Florenzano Johan Bergström Xavier Grangier Sergey Shepelev +Chris Dent diff --git a/gunicorn/http/response.py b/gunicorn/http/response.py index 002f191a..7552d289 100644 --- a/gunicorn/http/response.py +++ b/gunicorn/http/response.py @@ -53,5 +53,7 @@ class Response(object): write(self.req.socket, arg, self.chunked) def close(self): + if not self.headers_sent: + self.send_headers() if self.chunked: write_chunk(self.socket, "") \ No newline at end of file