[Zope-Checkins] SVN: Zope/trunk/lib/python/ZPublisher/ Collector #1864, #1906: fixed header normalization in appendHeader()

Andreas Jung andreas at andreas-jung.com
Sat Sep 24 06:23:19 EDT 2005


Log message for revision 38582:
  Collector #1864, #1906: fixed header normalization in appendHeader()
  

Changed:
  U   Zope/trunk/lib/python/ZPublisher/HTTPResponse.py
  U   Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py

-=-
Modified: Zope/trunk/lib/python/ZPublisher/HTTPResponse.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/HTTPResponse.py	2005-09-24 10:06:12 UTC (rev 38581)
+++ Zope/trunk/lib/python/ZPublisher/HTTPResponse.py	2005-09-24 10:23:19 UTC (rev 38582)
@@ -544,7 +544,7 @@
         Sets an HTTP return header "name" with value "value",
         appending it following a comma if there was a previous value
         set for the header. '''
-        name = str(name)
+        name = str(name).lower()
         value = str(value)
 
         headers = self.headers

Modified: Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py
===================================================================
--- Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py	2005-09-24 10:06:12 UTC (rev 38581)
+++ Zope/trunk/lib/python/ZPublisher/tests/testHTTPResponse.py	2005-09-24 10:23:19 UTC (rev 38582)
@@ -65,6 +65,16 @@
         self.assertEqual(cookie.get('value'), 'bar:baz')
         self.assertEqual(cookie.get('path'), '/')
 
+    def test_appendHeader(self):
+        response = self._makeOne()
+        response.setHeader('foo', 'bar')
+        response.appendHeader('foo', 'foo')
+        self.assertEqual(response.headers.get('foo'), 'bar,\n\tfoo')
+        response.setHeader('xxx', 'bar')
+        response.appendHeader('XXX', 'foo')
+        self.assertEqual(response.headers.get('xxx'), 'bar,\n\tfoo')
+
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(HTTPResponseTests, 'test'))



More information about the Zope-Checkins mailing list