[CMF-checkins] SVN: CMF/trunk/CMFCore/ - Move the fix for collector issue 372 to the trunk, it ended up on a branch

Jens Vagelpohl jens at dataflake.org
Tue Aug 16 17:12:19 EDT 2005


Log message for revision 37973:
  - Move the fix for collector issue 372 to the trunk, it ended up on a branch
  

Changed:
  U   CMF/trunk/CMFCore/FSFile.py
  U   CMF/trunk/CMFCore/FSImage.py
  U   CMF/trunk/CMFCore/tests/test_FSFile.py
  U   CMF/trunk/CMFCore/tests/test_FSImage.py

-=-
Modified: CMF/trunk/CMFCore/FSFile.py
===================================================================
--- CMF/trunk/CMFCore/FSFile.py	2005-08-16 20:54:10 UTC (rev 37972)
+++ CMF/trunk/CMFCore/FSFile.py	2005-08-16 21:12:19 UTC (rev 37973)
@@ -137,11 +137,11 @@
         RESPONSE.setHeader('Last-Modified', rfc1123_date(last_mod))
         RESPONSE.setHeader('Content-Type', self.content_type)
 
-        # We always set a content-length, even if the response is a 304,
-        # contrary to RFC 2616 because Apache proxies < 1.3.27
-        # will set a content-length header of "0" if one is not present
-        # in the response.  See http://www.zope.org/Collectors/Zope/544
-        RESPONSE.setHeader('Content-Length', data_len)
+        if status != 304:
+            # Avoid setting content-length for a 304. See RFC 2616.
+            # Zope might still, for better or for worse, set a 
+            # content-length header with value "0".
+            RESPONSE.setHeader('Content-Length', data_len)
 
         #There are 2 Cache Managers which can be in play....
         #need to decide which to use to determine where the cache headers

Modified: CMF/trunk/CMFCore/FSImage.py
===================================================================
--- CMF/trunk/CMFCore/FSImage.py	2005-08-16 20:54:10 UTC (rev 37972)
+++ CMF/trunk/CMFCore/FSImage.py	2005-08-16 21:12:19 UTC (rev 37973)
@@ -125,11 +125,11 @@
         RESPONSE.setHeader('Last-Modified', rfc1123_date(last_mod))
         RESPONSE.setHeader('Content-Type', self.content_type)
 
-        # We always set a content-length, even if the response is a 304,
-        # contrary to RFC 2616 because Apache proxies < 1.3.27
-        # will set a content-length header of "0" if one is not present
-        # in the response.  See http://www.zope.org/Collectors/Zope/544
-        RESPONSE.setHeader('Content-Length', data_len)
+        if status != 304:
+            # Avoid setting content-length for a 304. See RFC 2616.
+            # Zope might still, for better or for worse, set a
+            # content-length header with value "0". 
+            RESPONSE.setHeader('Content-Length', data_len)
 
         #There are 2 Cache Managers which can be in play....
         #need to decide which to use to determine where the cache headers

Modified: CMF/trunk/CMFCore/tests/test_FSFile.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSFile.py	2005-08-16 20:54:10 UTC (rev 37972)
+++ CMF/trunk/CMFCore/tests/test_FSFile.py	2005-08-16 21:12:19 UTC (rev 37973)
@@ -117,9 +117,9 @@
         data = file.index_html( self.REQUEST, self.RESPONSE )
 
         self.assertEqual( data, '' )
-        # test that we properly hack around apache bug noted in code
+        # test that we don't supply a content-length
         self.assertEqual( self.RESPONSE.getHeader('Content-Length'.lower()),
-                                                  str(len(ref)) )
+                                               None )
         self.assertEqual( self.RESPONSE.getStatus(), 304 )
 
     def test_index_html_without_304( self ):

Modified: CMF/trunk/CMFCore/tests/test_FSImage.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_FSImage.py	2005-08-16 20:54:10 UTC (rev 37972)
+++ CMF/trunk/CMFCore/tests/test_FSImage.py	2005-08-16 21:12:19 UTC (rev 37973)
@@ -105,9 +105,9 @@
         data = image.index_html( self.REQUEST, self.RESPONSE )
 
         self.assertEqual( data, '' )
-        # test that we properly hack around apache bug noted in code
+        # test that we don't supply a content-length
         self.assertEqual( self.RESPONSE.getHeader('Content-Length'.lower()),
-                                                  str(len(ref)) )
+                                                  None )
         self.assertEqual( self.RESPONSE.getStatus(), 304 )
 
     def test_index_html_without_304( self ):



More information about the CMF-checkins mailing list