From 3795b2c8bae9c09131bb72b662333bdf39771512 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Sun, 24 Jul 2022 07:15:49 -0700 Subject: [PATCH] Add compression scheme to header (#15395) For easier debugging. We still do not return compressed size for security reasons. --- cmd/api-headers.go | 7 +++++++ internal/http/headers.go | 3 +++ 2 files changed, 10 insertions(+) diff --git a/cmd/api-headers.go b/cmd/api-headers.go index 2a8b2ab04..60cd14f14 100644 --- a/cmd/api-headers.go +++ b/cmd/api-headers.go @@ -199,5 +199,12 @@ func setObjectHeaders(w http.ResponseWriter, objInfo ObjectInfo, rs *HTTPRangeSp lc.SetPredictionHeaders(w, objInfo.ToLifecycleOpts()) } + if v, ok := objInfo.UserDefined[ReservedMetadataPrefix+"compression"]; ok { + if i := strings.LastIndexByte(v, '/'); i >= 0 { + v = v[i+1:] + } + w.Header()[xhttp.MinIOCompressed] = []string{v} + } + return nil } diff --git a/internal/http/headers.go b/internal/http/headers.go index 294dad0df..9b92dd4be 100644 --- a/internal/http/headers.go +++ b/internal/http/headers.go @@ -187,6 +187,9 @@ const ( MinIOSourceObjectLegalHoldTimestamp = "X-Minio-Source-Replication-LegalHold-Timestamp" // predicted date/time of transition MinIOTransition = "X-Minio-Transition" + + // MinIOCompressed is returned when object is compressed + MinIOCompressed = "X-Minio-Compressed" ) // Common http query params S3 API