[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Collector #1864, #1906: fixed header normalization in appendHeader()

Andreas Jung andreas at andreas-jung.com
Sat Sep 24 06:34:49 EDT 2005


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

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPResponse.py
  U   Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPResponse.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2005-09-24 10:24:16 UTC (rev 38583)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt	2005-09-24 10:34:48 UTC (rev 38584)
@@ -31,6 +31,8 @@
 
     Bugs Fixed
 
+      - Collector #1864, #1906: fixed header normalization in appendHeader()
+
       - Collector #1899: fixed migration issue when using export/import for
         ZCatalog instances
 

Modified: Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPResponse.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPResponse.py	2005-09-24 10:24:16 UTC (rev 38583)
+++ Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPResponse.py	2005-09-24 10:34:48 UTC (rev 38584)
@@ -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/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPResponse.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPResponse.py	2005-09-24 10:24:16 UTC (rev 38583)
+++ Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPResponse.py	2005-09-24 10:34:48 UTC (rev 38584)
@@ -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