Commit f11ee613 authored by Casey Duncan's avatar Casey Duncan

Collector #574: Fixed write on HEAD requests caused by overzealous ETag support.

parent 3a24de4f
...@@ -6,9 +6,8 @@ Zope Changes ...@@ -6,9 +6,8 @@ Zope Changes
Bugs Fixed Bugs Fixed
- Fixed bug in manage_editProperties which used an incorrect default - Collector #574: Fixed write on HEAD requests caused by overzealous
for several types of property when they were not found in the ETag support.
REQUEST.
- Fixed broken management form for TopicIndexes. - Fixed broken management form for TopicIndexes.
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
############################################################################## ##############################################################################
__version__ = "$Revision: 1.8 $"[11:-2] __version__ = "$Revision: 1.9 $"[11:-2]
import time, Interface, re import time, Interface, re
...@@ -66,9 +66,11 @@ class EtagSupport: ...@@ -66,9 +66,11 @@ class EtagSupport:
""" """
__implements__ = (EtagBaseInterface,) __implements__ = (EtagBaseInterface,)
def http__etag(self): def http__etag(self, readonly=0):
try: etag = self.__etag try: etag = self.__etag
except AttributeError: except AttributeError:
if readonly: # Don't refresh the etag on reads
return
self.http__refreshEtag() self.http__refreshEtag()
etag = self.__etag etag = self.__etag
return etag return etag
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"""WebDAV support - resource objects.""" """WebDAV support - resource objects."""
__version__='$Revision: 1.53 $'[11:-2] __version__='$Revision: 1.54 $'[11:-2]
import sys, os, mimetypes, davcmds, ExtensionClass, Lockable import sys, os, mimetypes, davcmds, ExtensionClass, Lockable
from common import absattr, aq_base, urlfix, rfc1123_date, tokenFinder, urlbase from common import absattr, aq_base, urlfix, rfc1123_date, tokenFinder, urlbase
...@@ -167,7 +167,9 @@ class Resource(ExtensionClass.Base, Lockable.LockableItem): ...@@ -167,7 +167,9 @@ class Resource(ExtensionClass.Base, Lockable.LockableItem):
mtime=rfc1123_date(self._p_mtime) mtime=rfc1123_date(self._p_mtime)
RESPONSE.setHeader('Last-Modified', mtime) RESPONSE.setHeader('Last-Modified', mtime)
if hasattr(aq_base(self), 'http__etag'): if hasattr(aq_base(self), 'http__etag'):
RESPONSE.setHeader('Etag', self.aq_base.http__etag()) etag = self.http__etag(readonly=1)
if etag:
RESPONSE.setHeader('Etag', etag)
RESPONSE.setStatus(200) RESPONSE.setStatus(200)
return RESPONSE return RESPONSE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment