Preserve ETag case for S3 compatibility (#7498)
Most hadoop distributions hortonworks, cloudera all depend on aws-sdk-java 1.7.x to 1.10.x - the releases which have bugs related case sensitive check for ETag header. Go changes the case of the headers set to be canonical but only preserves them when set through a direct map. This fixes most compatibility issues we have had in the past supporting older hadoop distributions.
This commit is contained in:
committed by
kannappanr
parent
10a607154d
commit
a2e344bf30
@@ -76,7 +76,7 @@ func setObjectHeaders(w http.ResponseWriter, objInfo ObjectInfo, rs *HTTPRangeSp
|
||||
|
||||
// Set Etag if available.
|
||||
if objInfo.ETag != "" {
|
||||
w.Header().Set("ETag", "\""+objInfo.ETag+"\"")
|
||||
w.Header()["ETag"] = []string{"\"" + objInfo.ETag + "\""}
|
||||
}
|
||||
|
||||
if objInfo.ContentType != "" {
|
||||
@@ -90,6 +90,7 @@ func setObjectHeaders(w http.ResponseWriter, objInfo ObjectInfo, rs *HTTPRangeSp
|
||||
if !objInfo.Expires.IsZero() {
|
||||
w.Header().Set("Expires", objInfo.Expires.UTC().Format(http.TimeFormat))
|
||||
}
|
||||
|
||||
// Set all other user defined metadata.
|
||||
for k, v := range objInfo.UserDefined {
|
||||
if hasPrefix(k, ReservedMetadataPrefix) {
|
||||
|
||||
Reference in New Issue
Block a user