SVN: r25712 - in branches/quixote1: . server
Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Tue, 7 Dec 2004 17:57:39 -0500
| Newsgroups | gmane.comp.web.quixote.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: nascheme
Date: 2004-12-07 17:57:18 -0500 (Tue, 07 Dec 2004)
New Revision: 25712
Modified:
branches/quixote1/ACKS
branches/quixote1/server/twisted_http.py
Log:
Use the Twisted addCookie() method. It allows multiple Set-Cookie
headers to end up in the response.
Modified: branches/quixote1/ACKS
===================================================================
--- branches/quixote1/ACKS 2004-12-07 22:52:41 UTC (rev 25711)
+++ branches/quixote1/ACKS 2004-12-07 22:57:18 UTC (rev 25712)
@@ -12,6 +12,7 @@
Oleg Broytmann
David M. Cooke
Jonathan Corbet
+David Creemer
Herman Cuppens
Toby Dickenson
Ray Drew
Modified: branches/quixote1/server/twisted_http.py
===================================================================
--- branches/quixote1/server/twisted_http.py 2004-12-07 22:52:41 UTC (rev 25711)
+++ branches/quixote1/server/twisted_http.py 2004-12-07 22:57:18 UTC (rev 25712)
@@ -44,7 +44,14 @@
resp = qxrequest.response
self.setResponseCode(resp.status_code)
for hdr, value in resp.generate_headers():
- self.setHeader(hdr, value)
+ if hdr != 'Set-Cookie':
+ self.setHeader(hdr, value)
+ # Cookies get special treatment since it seems Twisted cannot handle
+ # multiple Set-Cookie headers.
+ for name, attrs in resp.cookies.items():
+ attrs = attrs.copy()
+ value = attrs.pop('value')
+ self.addCookie(name, value, **attrs)
if resp.body is not None:
TWProducer(resp.body, self)
else: