fix crash with bad content_md5
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
2c3a1133c3
commit
4963b19bef
@ -88,6 +88,8 @@ def get_err_response(code):
|
|||||||
(HTTP_BAD_REQUEST, 'The specified bucket is not valid'),
|
(HTTP_BAD_REQUEST, 'The specified bucket is not valid'),
|
||||||
'InvalidURI':
|
'InvalidURI':
|
||||||
(HTTP_BAD_REQUEST, 'Could not parse the specified URI'),
|
(HTTP_BAD_REQUEST, 'Could not parse the specified URI'),
|
||||||
|
'InvalidDigest':
|
||||||
|
(HTTP_BAD_REQUEST, 'The Content-MD5 you specified was invalid'),
|
||||||
'NoSuchBucket':
|
'NoSuchBucket':
|
||||||
(HTTP_NOT_FOUND, 'The specified bucket does not exist'),
|
(HTTP_NOT_FOUND, 'The specified bucket does not exist'),
|
||||||
'SignatureDoesNotMatch':
|
'SignatureDoesNotMatch':
|
||||||
@ -374,7 +376,10 @@ class ObjectController(WSGIContext):
|
|||||||
del env[key]
|
del env[key]
|
||||||
env['HTTP_X_OBJECT_META_' + key[16:]] = value
|
env['HTTP_X_OBJECT_META_' + key[16:]] = value
|
||||||
elif key == 'HTTP_CONTENT_MD5':
|
elif key == 'HTTP_CONTENT_MD5':
|
||||||
env['HTTP_ETAG'] = value.decode('base64').encode('hex')
|
try:
|
||||||
|
env['HTTP_ETAG'] = value.decode('base64').encode('hex')
|
||||||
|
except:
|
||||||
|
return get_err_response('InvalidDigest')
|
||||||
elif key == 'HTTP_X_AMZ_COPY_SOURCE':
|
elif key == 'HTTP_X_AMZ_COPY_SOURCE':
|
||||||
env['HTTP_X_COPY_FROM'] = value
|
env['HTTP_X_COPY_FROM'] = value
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user