Merge "Allow EC to ignore invalid request ETag"
This commit is contained in:
commit
8e66d1278b
@ -2643,19 +2643,13 @@ class ECObjectController(BaseObjectController):
|
||||
self.app.logger.increment('client_disconnects')
|
||||
raise HTTPClientDisconnect(request=req)
|
||||
|
||||
computed_etag = (etag_hasher.hexdigest()
|
||||
if etag_hasher else None)
|
||||
received_etag = req.headers.get(
|
||||
'etag', '').strip('"')
|
||||
if (computed_etag and received_etag and
|
||||
computed_etag != received_etag):
|
||||
raise HTTPUnprocessableEntity(request=req)
|
||||
|
||||
send_chunk('') # flush out any buffered data
|
||||
|
||||
computed_etag = (etag_hasher.hexdigest()
|
||||
if etag_hasher else None)
|
||||
footers = self._get_footers(req)
|
||||
received_etag = footers.get(
|
||||
'etag', '').strip('"')
|
||||
received_etag = footers.get('etag', req.headers.get(
|
||||
'etag', '')).strip('"')
|
||||
if (computed_etag and received_etag and
|
||||
computed_etag != received_etag):
|
||||
raise HTTPUnprocessableEntity(request=req)
|
||||
|
@ -4349,6 +4349,17 @@ class TestECObjControllerMimePutter(BaseObjectControllerMixin,
|
||||
for conn in conns:
|
||||
self.assertTrue(conn.closed)
|
||||
|
||||
# make the footers callback send the correct etag
|
||||
footers_callback = make_footers_callback(test_body)
|
||||
env = {'swift.callback.update_footers': footers_callback}
|
||||
headers = {'Etag': 'bad etag'}
|
||||
req = swift.common.swob.Request.blank(
|
||||
'/v1/a/c/o', method='PUT', headers=headers, environ=env,
|
||||
body=test_body)
|
||||
with set_http_connect(*codes, expect_headers=self.expect_headers):
|
||||
resp = req.get_response(self.app)
|
||||
self.assertEqual(201, resp.status_int)
|
||||
|
||||
# make the footers callback send a bad Etag footer
|
||||
footers_callback = make_footers_callback('not the test body')
|
||||
env = {'swift.callback.update_footers': footers_callback}
|
||||
|
Loading…
x
Reference in New Issue
Block a user