@ -411,19 +411,40 @@ func (api objectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Req
gr , err := getObjectNInfo ( ctx , bucket , object , rs , r . Header , readLock , opts )
gr , err := getObjectNInfo ( ctx , bucket , object , rs , r . Header , readLock , opts )
if err != nil {
if err != nil {
if isErrPreconditionFailed ( err ) {
var (
return
reader * GetObjectReader
proxy bool
)
if isProxyable ( ctx , bucket ) {
// proxy to replication target if active-active replication is in place.
reader , proxy = proxyGetToReplicationTarget ( ctx , bucket , object , rs , r . Header , opts )
if reader != nil && proxy {
gr = reader
}
}
}
if globalBucketVersioningSys . Enabled ( bucket ) && gr != nil {
if reader == nil || ! proxy {
// Versioning enabled quite possibly object is deleted might be delete-marker
if isErrPreconditionFailed ( err ) {
// if present set the headers, no idea why AWS S3 sets these headers.
return
if gr . ObjInfo . VersionID != "" && gr . ObjInfo . DeleteMarker {
w . Header ( ) [ xhttp . AmzVersionID ] = [ ] string { gr . ObjInfo . VersionID }
w . Header ( ) [ xhttp . AmzDeleteMarker ] = [ ] string { strconv . FormatBool ( gr . ObjInfo . DeleteMarker ) }
}
}
if globalBucketVersioningSys . Enabled ( bucket ) && gr != nil {
if ! gr . ObjInfo . VersionPurgeStatus . Empty ( ) {
// Shows the replication status of a permanent delete of a version
w . Header ( ) [ xhttp . MinIODeleteReplicationStatus ] = [ ] string { string ( gr . ObjInfo . VersionPurgeStatus ) }
}
if ! gr . ObjInfo . ReplicationStatus . Empty ( ) && gr . ObjInfo . DeleteMarker {
w . Header ( ) [ xhttp . MinIODeleteMarkerReplicationStatus ] = [ ] string { string ( gr . ObjInfo . ReplicationStatus ) }
}
// Versioning enabled quite possibly object is deleted might be delete-marker
// if present set the headers, no idea why AWS S3 sets these headers.
if gr . ObjInfo . VersionID != "" && gr . ObjInfo . DeleteMarker {
w . Header ( ) [ xhttp . AmzVersionID ] = [ ] string { gr . ObjInfo . VersionID }
w . Header ( ) [ xhttp . AmzDeleteMarker ] = [ ] string { strconv . FormatBool ( gr . ObjInfo . DeleteMarker ) }
}
}
writeErrorResponse ( ctx , w , toAPIError ( ctx , err ) , r . URL , guessIsBrowserReq ( r ) )
return
}
}
writeErrorResponse ( ctx , w , toAPIError ( ctx , err ) , r . URL , guessIsBrowserReq ( r ) )
return
}
}
defer gr . Close ( )
defer gr . Close ( )
@ -577,23 +598,37 @@ func (api objectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Re
objInfo , err := getObjectInfo ( ctx , bucket , object , opts )
objInfo , err := getObjectInfo ( ctx , bucket , object , opts )
if err != nil {
if err != nil {
if globalBucketVersioningSys . Enabled ( bucket ) {
var (
if ! objInfo . VersionPurgeStatus . Empty ( ) {
proxy bool
// Shows the replication status of a permanent delete of a version
perr error
w . Header ( ) [ xhttp . MinIODeleteReplicationStatus ] = [ ] string { string ( objInfo . VersionPurgeStatus ) }
oi ObjectInfo
)
// proxy HEAD to replication target if active-active replication configured on bucket
if isProxyable ( ctx , bucket ) {
oi , proxy , perr = proxyHeadToReplicationTarget ( ctx , bucket , object , opts )
if proxy && perr == nil {
objInfo = oi
}
}
if ! objInfo . ReplicationStatus . Empty ( ) && objInfo . DeleteMarker {
}
w . Header ( ) [ xhttp . MinIODeleteMarkerReplicationStatus ] = [ ] string { string ( objInfo . ReplicationStatus ) }
if ! proxy || perr != nil {
}
if globalBucketVersioningSys . Enabled ( bucket ) {
// Versioning enabled quite possibly object is deleted might be delete-marker
if ! objInfo . VersionPurgeStatus . Empty ( ) {
// if present set the headers, no idea why AWS S3 sets these headers.
// Shows the replication status of a permanent delete of a version
if objInfo . VersionID != "" && objInfo . DeleteMarker {
w . Header ( ) [ xhttp . MinIODeleteReplicationStatus ] = [ ] string { string ( objInfo . VersionPurgeStatus ) }
w . Header ( ) [ xhttp . AmzVersionID ] = [ ] string { objInfo . VersionID }
}
w . Header ( ) [ xhttp . AmzDeleteMarker ] = [ ] string { strconv . FormatBool ( objInfo . DeleteMarker ) }
if ! objInfo . ReplicationStatus . Empty ( ) && objInfo . DeleteMarker {
w . Header ( ) [ xhttp . MinIODeleteMarkerReplicationStatus ] = [ ] string { string ( objInfo . ReplicationStatus ) }
}
// Versioning enabled quite possibly object is deleted might be delete-marker
// if present set the headers, no idea why AWS S3 sets these headers.
if objInfo . VersionID != "" && objInfo . DeleteMarker {
w . Header ( ) [ xhttp . AmzVersionID ] = [ ] string { objInfo . VersionID }
w . Header ( ) [ xhttp . AmzDeleteMarker ] = [ ] string { strconv . FormatBool ( objInfo . DeleteMarker ) }
}
}
}
writeErrorResponseHeadersOnly ( w , toAPIError ( ctx , err ) )
return
}
}
writeErrorResponseHeadersOnly ( w , toAPIError ( ctx , err ) )
return
}
}
// Automatically remove the object/version is an expiry lifecycle rule can be applied
// Automatically remove the object/version is an expiry lifecycle rule can be applied