SVN: r25711 - in trunk/quixote: . server

Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Tue, 7 Dec 2004 17:53:06 -0500
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
Author: nascheme
Date: 2004-12-07 17:52:41 -0500 (Tue, 07 Dec 2004)
New Revision: 25711

Modified:
   trunk/quixote/ACKS
   trunk/quixote/server/twisted_server.py
Log:
Use the Twisted addCookie() method.  It allows multiple Set-Cookie
headers to end up in the response.


Modified: trunk/quixote/ACKS
===================================================================
--- trunk/quixote/ACKS	2004-12-07 22:36:54 UTC (rev 25710)
+++ trunk/quixote/ACKS	2004-12-07 22:52:41 UTC (rev 25711)
@@ -13,6 +13,7 @@
 Oleg Broytmann
 David M. Cooke
 Jonathan Corbet
+David Creemer
 Herman Cuppens
 Toby Dickenson
 Ray Drew

Modified: trunk/quixote/server/twisted_server.py
===================================================================
--- trunk/quixote/server/twisted_server.py	2004-12-07 22:36:54 UTC (rev 25710)
+++ trunk/quixote/server/twisted_server.py	2004-12-07 22:52:41 UTC (rev 25711)
@@ -34,7 +34,14 @@
         qxresponse = self.channel.factory.publisher.process_request(qxrequest)
         self.setResponseCode(qxresponse.status_code)
         for name, value in qxresponse.generate_headers():
-            self.setHeader(name, value)
+            if name != 'Set-Cookie':
+                self.setHeader(name, value)
+        # Cookies get special treatment since it seems Twisted cannot handle
+        # multiple Set-Cookie headers.
+        for name, attrs in qxresponse.cookies.items():
+            attrs = attrs.copy()
+            value = attrs.pop('value')
+            self.addCookie(name, value, **attrs)
         QuixoteProducer(qxresponse, self)
 
     def create_environment(self):