@ -360,6 +360,14 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re
return
return
}
}
// Deny if WORM is enabled
if globalWORMEnabled {
if _ , err = objectAPI . GetObjectInfo ( ctx , dstBucket , dstObject ) ; err == nil {
writeErrorResponse ( w , ErrMethodNotAllowed , r . URL )
return
}
}
if objectAPI . IsEncryptionSupported ( ) {
if objectAPI . IsEncryptionSupported ( ) {
if apiErr , _ := DecryptCopyObjectInfo ( & srcInfo , r . Header ) ; apiErr != ErrNone {
if apiErr , _ := DecryptCopyObjectInfo ( & srcInfo , r . Header ) ; apiErr != ErrNone {
writeErrorResponse ( w , apiErr , r . URL )
writeErrorResponse ( w , apiErr , r . URL )
@ -681,6 +689,14 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
return
return
}
}
// Deny if WORM is enabled
if globalWORMEnabled {
if _ , err = objectAPI . GetObjectInfo ( ctx , bucket , object ) ; err == nil {
writeErrorResponse ( w , ErrMethodNotAllowed , r . URL )
return
}
}
if objectAPI . IsEncryptionSupported ( ) {
if objectAPI . IsEncryptionSupported ( ) {
if hasSSECustomerHeader ( r . Header ) && ! hasSuffix ( object , slashSeparator ) { // handle SSE-C requests
if hasSSECustomerHeader ( r . Header ) && ! hasSuffix ( object , slashSeparator ) { // handle SSE-C requests
reader , err = EncryptRequest ( hashReader , r , metadata )
reader , err = EncryptRequest ( hashReader , r , metadata )
@ -753,6 +769,14 @@ func (api objectAPIHandlers) NewMultipartUploadHandler(w http.ResponseWriter, r
return
return
}
}
// Deny if WORM is enabled
if globalWORMEnabled {
if _ , err := objectAPI . GetObjectInfo ( ctx , bucket , object ) ; err == nil {
writeErrorResponse ( w , ErrMethodNotAllowed , r . URL )
return
}
}
// Validate storage class metadata if present
// Validate storage class metadata if present
if _ , ok := r . Header [ amzStorageClassCanonical ] ; ok {
if _ , ok := r . Header [ amzStorageClassCanonical ] ; ok {
if ! isValidStorageClassMeta ( r . Header . Get ( amzStorageClassCanonical ) ) {
if ! isValidStorageClassMeta ( r . Header . Get ( amzStorageClassCanonical ) ) {
@ -863,6 +887,14 @@ func (api objectAPIHandlers) CopyObjectPartHandler(w http.ResponseWriter, r *htt
return
return
}
}
// Deny if WORM is enabled
if globalWORMEnabled {
if _ , err = objectAPI . GetObjectInfo ( ctx , dstBucket , dstObject ) ; err == nil {
writeErrorResponse ( w , ErrMethodNotAllowed , r . URL )
return
}
}
if objectAPI . IsEncryptionSupported ( ) {
if objectAPI . IsEncryptionSupported ( ) {
if apiErr , _ := DecryptCopyObjectInfo ( & srcInfo , r . Header ) ; apiErr != ErrNone {
if apiErr , _ := DecryptCopyObjectInfo ( & srcInfo , r . Header ) ; apiErr != ErrNone {
writeErrorResponse ( w , apiErr , r . URL )
writeErrorResponse ( w , apiErr , r . URL )
@ -1119,6 +1151,14 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
return
return
}
}
// Deny if WORM is enabled
if globalWORMEnabled {
if _ , err = objectAPI . GetObjectInfo ( ctx , bucket , object ) ; err == nil {
writeErrorResponse ( w , ErrMethodNotAllowed , r . URL )
return
}
}
if objectAPI . IsEncryptionSupported ( ) {
if objectAPI . IsEncryptionSupported ( ) {
var li ListPartsInfo
var li ListPartsInfo
li , err = objectAPI . ListObjectParts ( ctx , bucket , object , uploadID , 0 , 1 )
li , err = objectAPI . ListObjectParts ( ctx , bucket , object , uploadID , 0 , 1 )
@ -1200,6 +1240,14 @@ func (api objectAPIHandlers) AbortMultipartUploadHandler(w http.ResponseWriter,
return
return
}
}
// Deny if WORM is enabled
if globalWORMEnabled {
if _ , err := objectAPI . GetObjectInfo ( ctx , bucket , object ) ; err == nil {
writeErrorResponse ( w , ErrMethodNotAllowed , r . URL )
return
}
}
uploadID , _ , _ , _ := getObjectResources ( r . URL . Query ( ) )
uploadID , _ , _ , _ := getObjectResources ( r . URL . Query ( ) )
if err := objectAPI . AbortMultipartUpload ( ctx , bucket , object , uploadID ) ; err != nil {
if err := objectAPI . AbortMultipartUpload ( ctx , bucket , object , uploadID ) ; err != nil {
errorIf ( err , "AbortMultipartUpload failed" )
errorIf ( err , "AbortMultipartUpload failed" )
@ -1268,6 +1316,14 @@ func (api objectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWrite
return
return
}
}
// Deny if WORM is enabled
if globalWORMEnabled {
if _ , err := objectAPI . GetObjectInfo ( ctx , bucket , object ) ; err == nil {
writeErrorResponse ( w , ErrMethodNotAllowed , r . URL )
return
}
}
// Get upload id.
// Get upload id.
uploadID , _ , _ , _ := getObjectResources ( r . URL . Query ( ) )
uploadID , _ , _ , _ := getObjectResources ( r . URL . Query ( ) )
@ -1366,6 +1422,14 @@ func (api objectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http.
return
return
}
}
// Deny if WORM is enabled
if globalWORMEnabled {
// Not required to check whether given object exists or not, because
// DeleteObject is always successful irrespective of object existence.
writeErrorResponse ( w , ErrMethodNotAllowed , r . URL )
return
}
// http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html
// http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html
// Ignore delete object errors while replying to client, since we are
// Ignore delete object errors while replying to client, since we are
// suppposed to reply only 204. Additionally log the error for
// suppposed to reply only 204. Additionally log the error for