[CMF-checkins] SVN: CMF/branches/1.5/C - CMFCore.FSImage and
FSFile: Unlike the current behavior of Zope itself,
Jens Vagelpohl
jens at dataflake.org
Tue Aug 16 16:54:10 EDT 2005
Log message for revision 37972:
- CMFCore.FSImage and FSFile: Unlike the current behavior of Zope itself,
FSImage and FSFile would set a content-length response header for 304
(not modified) responses, which should not be done according to
RFC 2616. It won't do so anymore, but Zope itself will still force a
content-length header in ZServer.HTTPResponse. This misbehavior
has been filed as a Zope issue (http://www.zope.org/Collectors/Zope/1866).
(http://www.zope.org/Collectors/CMF/372)
Changed:
U CMF/branches/1.5/CHANGES.txt
U CMF/branches/1.5/CMFCore/FSFile.py
U CMF/branches/1.5/CMFCore/FSImage.py
U CMF/branches/1.5/CMFCore/tests/test_FSFile.py
U CMF/branches/1.5/CMFCore/tests/test_FSImage.py
-=-
Modified: CMF/branches/1.5/CHANGES.txt
===================================================================
--- CMF/branches/1.5/CHANGES.txt 2005-08-16 20:52:53 UTC (rev 37971)
+++ CMF/branches/1.5/CHANGES.txt 2005-08-16 20:54:10 UTC (rev 37972)
@@ -2,6 +2,14 @@
Bug Fixes
+ - CMFCore.FSImage and FSFile: Unlike the current behavior of Zope itself,
+ FSImage and FSFile would set a content-length response header for 304
+ (not modified) responses, which should not be done according to
+ RFC 2616. It won't do so anymore, but Zope itself will still force a
+ content-length header in ZServer.HTTPResponse. This misbehavior
+ has been filed as a Zope issue (http://www.zope.org/Collectors/Zope/1866).
+ (http://www.zope.org/Collectors/CMF/372)
+
- PortalFolder: Improved the _checkId method.
Method Aliases mask objects with matching IDs. Thus _checkId() and
checkIdAvailable() now make sure non-managers can't create objects with
Modified: CMF/branches/1.5/CMFCore/FSFile.py
===================================================================
--- CMF/branches/1.5/CMFCore/FSFile.py 2005-08-16 20:52:53 UTC (rev 37971)
+++ CMF/branches/1.5/CMFCore/FSFile.py 2005-08-16 20:54:10 UTC (rev 37972)
@@ -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/branches/1.5/CMFCore/FSImage.py
===================================================================
--- CMF/branches/1.5/CMFCore/FSImage.py 2005-08-16 20:52:53 UTC (rev 37971)
+++ CMF/branches/1.5/CMFCore/FSImage.py 2005-08-16 20:54:10 UTC (rev 37972)
@@ -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/branches/1.5/CMFCore/tests/test_FSFile.py
===================================================================
--- CMF/branches/1.5/CMFCore/tests/test_FSFile.py 2005-08-16 20:52:53 UTC (rev 37971)
+++ CMF/branches/1.5/CMFCore/tests/test_FSFile.py 2005-08-16 20:54:10 UTC (rev 37972)
@@ -120,9 +120,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/branches/1.5/CMFCore/tests/test_FSImage.py
===================================================================
--- CMF/branches/1.5/CMFCore/tests/test_FSImage.py 2005-08-16 20:52:53 UTC (rev 37971)
+++ CMF/branches/1.5/CMFCore/tests/test_FSImage.py 2005-08-16 20:54:10 UTC (rev 37972)
@@ -108,9 +108,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