Browse Source

check signature only when auth is enabled

random_access_file
Chris Lu 4 years ago
parent
commit
828a5ae429
  1. 4
      weed/s3api/s3api_object_handlers.go
  2. 4
      weed/s3api/s3api_object_multipart_handlers.go

4
weed/s3api/s3api_object_handlers.go

@ -40,8 +40,9 @@ func (s3a *S3ApiServer) PutObjectHandler(w http.ResponseWriter, r *http.Request)
return
}
rAuthType := getRequestAuthType(r)
dataReader := r.Body
if s3a.iam.isEnabled() {
rAuthType := getRequestAuthType(r)
var s3ErrCode ErrorCode
switch rAuthType {
case authTypeStreamingSigned:
@ -55,6 +56,7 @@ func (s3a *S3ApiServer) PutObjectHandler(w http.ResponseWriter, r *http.Request)
writeErrorResponse(w, s3ErrCode, r.URL)
return
}
}
defer dataReader.Close()
if strings.HasSuffix(object, "/") {

4
weed/s3api/s3api_object_multipart_handlers.go

@ -179,8 +179,9 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ
return
}
rAuthType := getRequestAuthType(r)
dataReader := r.Body
if s3a.iam.isEnabled() {
rAuthType := getRequestAuthType(r)
var s3ErrCode ErrorCode
switch rAuthType {
case authTypeStreamingSigned:
@ -194,6 +195,7 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ
writeErrorResponse(w, s3ErrCode, r.URL)
return
}
}
defer dataReader.Close()
uploadUrl := fmt.Sprintf("http://%s%s/%s/%04d.part?collection=%s",

Loading…
Cancel
Save