api: Implement support for additional request headers.

Now GetObject and HeadObject both support

  - If-Modified-Since, If-Unmodified-Since
  - If-Match, If-None-Match

request headers.

These headers are used to further handle the responses for GetObject
and HeadObject API.

Fixes #1098
This commit is contained in:
Harshavardhana
2016-02-28 18:10:37 -08:00
parent 0b2e449727
commit ee1b86e517
4 changed files with 153 additions and 8 deletions
+3 -3
View File
@@ -298,7 +298,7 @@ func generateListObjectsResponse(bucket, prefix, marker, delimiter string, maxKe
continue
}
content.Key = object.Object
content.LastModified = object.LastModified.Format(timeFormatAMZ)
content.LastModified = object.LastModified.UTC().Format(timeFormatAMZ)
if object.MD5 != "" {
content.ETag = "\"" + object.MD5 + "\""
}
@@ -331,7 +331,7 @@ func generateListObjectsResponse(bucket, prefix, marker, delimiter string, maxKe
func generateCopyObjectResponse(etag string, lastModified time.Time) CopyObjectResponse {
return CopyObjectResponse{
ETag: "\"" + etag + "\"",
LastModified: lastModified.Format(timeFormatAMZ),
LastModified: lastModified.UTC().Format(timeFormatAMZ),
}
}
@@ -378,7 +378,7 @@ func generateListPartsResponse(objectMetadata fs.ObjectResourcesMetadata) ListPa
newPart.PartNumber = part.PartNumber
newPart.ETag = "\"" + part.ETag + "\""
newPart.Size = part.Size
newPart.LastModified = part.LastModified.Format(timeFormatAMZ)
newPart.LastModified = part.LastModified.UTC().Format(timeFormatAMZ)
listPartsResponse.Parts = append(listPartsResponse.Parts, newPart)
}
return listPartsResponse