aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_object_handlers.go
diff options
context:
space:
mode:
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)