- object write cache control

- object write expires
This commit is contained in:
Konstantin Lebedev
2021-05-24 15:43:55 +05:00
parent 15859a7daa
commit 69c768870b
5 changed files with 23 additions and 4 deletions

View File

@@ -6,12 +6,14 @@ import (
"encoding/xml"
"fmt"
"github.com/chrislusf/seaweedfs/weed/filer"
"github.com/pquerna/cachecontrol/cacheobject"
"io"
"io/ioutil"
"net/http"
"net/url"
"sort"
"strings"
"time"
"github.com/chrislusf/seaweedfs/weed/s3api/s3err"
@@ -46,6 +48,20 @@ func (s3a *S3ApiServer) PutObjectHandler(w http.ResponseWriter, r *http.Request)
return
}
if r.Header.Get("Cache-Control") != "" {
if _, err = cacheobject.ParseRequestCacheControl(r.Header.Get("Cache-Control")); err != nil {
writeErrorResponse(w, s3err.ErrInvalidDigest, r.URL)
return
}
}
if r.Header.Get("Expires") != "" {
if _, err = time.Parse(http.TimeFormat, r.Header.Get("Expires")); err != nil {
writeErrorResponse(w, s3err.ErrInvalidDigest, r.URL)
return
}
}
dataReader := r.Body
if s3a.iam.isEnabled() {
rAuthType := getRequestAuthType(r)