@ -974,6 +974,14 @@ func (api objectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWrite
// Send 200 OK
// Send 200 OK
setCommonHeaders ( w )
setCommonHeaders ( w )
w . WriteHeader ( http . StatusOK )
w . WriteHeader ( http . StatusOK )
// Xml headers need to be sent before we possibly send whitespace characters
// to the client.
_ , err = w . Write ( [ ] byte ( xml . Header ) )
if err != nil {
errorIf ( err , "Unable to write XML header for complete multipart upload" )
writeErrorResponseNoHeader ( w , r , ErrInternalError , r . URL . Path )
return
}
doneCh := make ( chan struct { } )
doneCh := make ( chan struct { } )
// Signal that completeMultipartUpload is over via doneCh
// Signal that completeMultipartUpload is over via doneCh
@ -992,7 +1000,7 @@ func (api objectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWrite
writePartSmallErrorResponse ( w , r , oErr )
writePartSmallErrorResponse ( w , r , oErr )
default :
default :
// Handle all other generic issues.
// Handle all other generic issues.
writeErrorResponseNoHeader ( w , r , getAPIError ( toAPIErrorCode ( err ) ) , r . URL . Path )
writeErrorResponseNoHeader ( w , r , toAPIErrorCode ( err ) , r . URL . Path )
}
}
return
return
}
}
@ -1001,7 +1009,12 @@ func (api objectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWrite
location := getLocation ( r )
location := getLocation ( r )
// Generate complete multipart response.
// Generate complete multipart response.
response := generateCompleteMultpartUploadResponse ( bucket , object , location , md5Sum )
response := generateCompleteMultpartUploadResponse ( bucket , object , location , md5Sum )
encodedSuccessResponse := encodeResponse ( response )
encodedSuccessResponse , err := xml . Marshal ( response )
if err != nil {
errorIf ( err , "Unable to parse CompleteMultipartUpload response" )
writeErrorResponseNoHeader ( w , r , ErrInternalError , r . URL . Path )
return
}
// write success response.
// write success response.
w . Write ( encodedSuccessResponse )
w . Write ( encodedSuccessResponse )
w . ( http . Flusher ) . Flush ( )
w . ( http . Flusher ) . Flush ( )