response headers should be a tupple.

This commit is contained in:
Benoit Chesneau 2010-02-10 16:07:05 +01:00
parent 54357b3487
commit 61840c3707
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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))