[#312] Support Expires and Cache-Control headers

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-01-27 16:37:43 +03:00 committed by Angira Kekteeva
parent 8fc19b11db
commit 9be4bbbed4
2 changed files with 13 additions and 0 deletions

View file

@ -85,6 +85,13 @@ func writeHeaders(h http.Header, info *data.ObjectInfo, tagSetLength int) {
h.Set(api.AmzVersionID, info.ID.String())
h.Set(api.AmzTaggingCount, strconv.Itoa(tagSetLength))
if cacheControl := info.Headers[api.CacheControl]; cacheControl != "" {
h.Set(api.CacheControl, cacheControl)
}
if expires := info.Headers[api.Expires]; expires != "" {
h.Set(api.Expires, expires)
}
for key, val := range info.Headers {
if layer.IsSystemHeader(key) {
continue

View file

@ -194,6 +194,12 @@ func (h *handler) PutObjectHandler(w http.ResponseWriter, r *http.Request) {
if contentType := r.Header.Get(api.ContentType); len(contentType) > 0 {
metadata[api.ContentType] = contentType
}
if cacheControl := r.Header.Get(api.CacheControl); len(cacheControl) > 0 {
metadata[api.CacheControl] = cacheControl
}
if expires := r.Header.Get(api.Expires); len(expires) > 0 {
metadata[api.Expires] = expires
}
params := &layer.PutObjectParams{
Bucket: reqInfo.BucketName,