Log message for revision 121447:
  ZPublisher: HTTPResponse.appendHeader now keeps header values to a single
  line by default to avoid causing problems for proxy servers which do not
  correctly handle multi-line headers.
  

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  U   Zope/branches/2.13/src/ZPublisher/HTTPResponse.py
  U   Zope/branches/2.13/src/ZPublisher/tests/testHTTPResponse.py

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.13/doc/CHANGES.rst  2011-04-19 09:24:05 UTC (rev 121446)
+++ Zope/branches/2.13/doc/CHANGES.rst  2011-04-19 15:01:30 UTC (rev 121447)
@@ -15,6 +15,10 @@
 Features Added
 ++++++++++++++
 
+- ZPublisher: HTTPResponse.appendHeader now keeps header values to a single
+  line by default to avoid causing problems for proxy servers which do not
+  correctly handle multi-line headers.
+
 - Updated distributions:
 
   - Products.ZCatalog = 2.13.9

Modified: Zope/branches/2.13/src/ZPublisher/HTTPResponse.py
===================================================================
--- Zope/branches/2.13/src/ZPublisher/HTTPResponse.py   2011-04-19 09:24:05 UTC 
(rev 121446)
+++ Zope/branches/2.13/src/ZPublisher/HTTPResponse.py   2011-04-19 15:01:30 UTC 
(rev 121447)
@@ -338,7 +338,7 @@
             name = literal and name or key
             self.headers[name] = value
 
-    def appendHeader(self, name, value, delimiter=","):
+    def appendHeader(self, name, value, delimiter=", "):
         """ Append a value to an HTTP return header.
 
         Set an HTTP return header "name" with value "value",
@@ -353,7 +353,7 @@
         headers = self.headers
         if headers.has_key(name):
             h = headers[name]
-            h = "%s%s\r\n\t%s" % (h, delimiter, value)
+            h = "%s%s%s" % (h, delimiter, value)
         else:
             h = value
         self.setHeader(name,h, scrubbed=True)

Modified: Zope/branches/2.13/src/ZPublisher/tests/testHTTPResponse.py
===================================================================
--- Zope/branches/2.13/src/ZPublisher/tests/testHTTPResponse.py 2011-04-19 
09:24:05 UTC (rev 121446)
+++ Zope/branches/2.13/src/ZPublisher/tests/testHTTPResponse.py 2011-04-19 
15:01:30 UTC (rev 121447)
@@ -445,13 +445,13 @@
         response = self._makeOne()
         response.setHeader('foo', 'bar')
         response.appendHeader('foo', 'foo')
-        self.assertEqual(response.headers.get('foo'), 'bar,\r\n\tfoo')
+        self.assertEqual(response.headers.get('foo'), 'bar, foo')
 
     def test_appendHeader_w_existing_case_insenstative(self):
         response = self._makeOne()
         response.setHeader('xxx', 'bar')
         response.appendHeader('XXX', 'foo')
-        self.assertEqual(response.headers.get('xxx'), 'bar,\r\n\tfoo')
+        self.assertEqual(response.headers.get('xxx'), 'bar, foo')
 
     def test_appendHeader_drops_CRLF(self):
         # RFC2616 disallows CRLF in a header value.

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
https://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to