aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_object_handlers.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2021-05-24 03:50:44 -0700
committerGitHub <noreply@github.com>2021-05-24 03:50:44 -0700
commit9079ce0e7f9eebd10b33cbe27f030a6f4f584d04 (patch)
tree82d62f2341bc7c30088a5cb62bc64b842a818986 /weed/s3api/s3api_object_handlers.go
parent15859a7daabd637cd91dede2cfc76d874e7174a4 (diff)
parent69c768870b7d939b3d531363771dff35318972b7 (diff)
downloadseaweedfs-9079ce0e7f9eebd10b33cbe27f030a6f4f584d04.tar.xz
seaweedfs-9079ce0e7f9eebd10b33cbe27f030a6f4f584d04.zip
Merge pull request #2079 from kmlebedev/s3CachingHeaders
S3 write cache headers
Diffstat (limited to 'weed/s3api/s3api_object_handlers.go')
-rw-r--r--weed/s3api/s3api_object_handlers.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go
index 2dde17b4c..e6731e5be 100644
--- a/weed/s3api/s3api_object_handlers.go
+++ b/weed/s3api/s3api_object_handlers.go
@@ -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)