diff options
| author | Konstantin Lebedev <lebedev_k@tochka.com> | 2021-05-24 15:43:55 +0500 |
|---|---|---|
| committer | Konstantin Lebedev <lebedev_k@tochka.com> | 2021-05-24 15:43:55 +0500 |
| commit | 69c768870b7d939b3d531363771dff35318972b7 (patch) | |
| tree | 82d62f2341bc7c30088a5cb62bc64b842a818986 /weed/s3api/s3api_object_handlers.go | |
| parent | 15859a7daabd637cd91dede2cfc76d874e7174a4 (diff) | |
| download | seaweedfs-69c768870b7d939b3d531363771dff35318972b7.tar.xz seaweedfs-69c768870b7d939b3d531363771dff35318972b7.zip | |
- object write cache control
- object write expires
Diffstat (limited to 'weed/s3api/s3api_object_handlers.go')
| -rw-r--r-- | weed/s3api/s3api_object_handlers.go | 16 |
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) |
