From 61840c370752a59adcaf664002dea717c7065dd7 Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Wed, 10 Feb 2010 16:07:05 +0100 Subject: [PATCH] response headers should be a tupple. --- gunicorn/http/request.py | 4 ++-- gunicorn/http/response.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gunicorn/http/request.py b/gunicorn/http/request.py index 6183e315..be6282f1 100644 --- a/gunicorn/http/request.py +++ b/gunicorn/http/request.py @@ -42,7 +42,7 @@ class Request(object): self.client_address = client_address self.server_address = server_address self.response_status = None - self.response_headers = {} + self.response_headers = [] self._version = 11 self.parser = Parser() self.start_response_called = False @@ -169,5 +169,5 @@ class Request(object): name = normalize_name(name) if not isinstance(value, basestring): value = str(value) - self.response_headers[name] = value.strip() + self.response_headers.append((name, value.strip())) self.start_response_called = True diff --git a/gunicorn/http/response.py b/gunicorn/http/response.py index b29adeb3..cad1dce1 100644 --- a/gunicorn/http/response.py +++ b/gunicorn/http/response.py @@ -11,7 +11,7 @@ class Response(object): self.req = req self.sock = sock self.data = response - self.headers = req.response_headers or {} + self.headers = req.response_headers or [] self.status = req.response_status self.SERVER_VERSION = req.SERVER_VERSION @@ -26,7 +26,7 @@ class Response(object): resp_head.append("Status: %s\r\n" % str(self.status)) # always close the connection resp_head.append("Connection: close\r\n") - for name, value in self.headers.items(): + for name, value in self.headers: resp_head.append("%s: %s\r\n" % (name, value)) write(self.sock, "%s\r\n" % "".join(resp_head))