Assume ETag is always in the metadata

Currently the GET and HEAD calls always assume that the ETag is
present in the on-disk metadata, as they index the metadata dictionary
directly for the value to fill in the proper response header (a
KeyError would be thrown if missing and turn into a 503).

The close code that handles quarantining checked to see if an ETag is
present in the metadata before making the comparison. However, a close
operation would never even be attempted if an ETag was not present,
since the response headers are filled in before the object is read.

Change-Id: I5032251414eceb38079d235504cc9e589dea5f3e
Signed-off-by: Peter Portante <peter.portante@redhat.com>
This commit is contained in:
Peter Portante 2013-09-03 23:08:14 -04:00
parent 21c322c35d
commit 30b1590c3c

View File

@ -586,8 +586,7 @@ class DiskFile(object):
return
if self.iter_etag and self.started_at_0 and self.read_to_eof and \
'ETag' in self._metadata and \
self.iter_etag.hexdigest() != self._metadata.get('ETag'):
self.iter_etag.hexdigest() != self._metadata['ETag']:
self.quarantine()
def close(self, verify_file=True):