added check for non-zero byte bodies in copy requests

This commit is contained in:
John Dickinson 2010-10-19 17:13:23 -05:00
parent 9b299b94b4
commit 740a9ba774

View File

@ -100,6 +100,12 @@ def check_object_creation(req, object_name):
if req.content_length is None and \
req.headers.get('transfer-encoding') != 'chunked':
return HTTPLengthRequired(request=req)
if ((req.method == 'COPY' or
(req.method == 'PUT' and 'X-Copy-From' in req.headers)) and
req.headers.get('transfer-encoding') != 'chunked' and
req.content_length > 0):
return HTTPBadRequest(body='Copy requests require a zero byte body',
request=req, content_type='text/plain')
if len(object_name) > MAX_OBJECT_NAME_LENGTH:
return HTTPBadRequest(body='Object name length of %d longer than %d' %
(len(object_name), MAX_OBJECT_NAME_LENGTH), request=req,