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 return
} }
rAuthType := getRequestAuthType(r)
dataReader := r.Body dataReader := r.Body
if s3a.iam.isEnabled() {
rAuthType := getRequestAuthType(r)
var s3ErrCode ErrorCode var s3ErrCode ErrorCode
switch rAuthType { switch rAuthType {
case authTypeStreamingSigned: case authTypeStreamingSigned:
@ -55,6 +56,7 @@ func (s3a *S3ApiServer) PutObjectHandler(w http.ResponseWriter, r *http.Request)
writeErrorResponse(w, s3ErrCode, r.URL) writeErrorResponse(w, s3ErrCode, r.URL)
return return
} }
}
defer dataReader.Close() defer dataReader.Close()
if strings.HasSuffix(object, "/") { 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 return
} }
rAuthType := getRequestAuthType(r)
dataReader := r.Body dataReader := r.Body
if s3a.iam.isEnabled() {
rAuthType := getRequestAuthType(r)
var s3ErrCode ErrorCode var s3ErrCode ErrorCode
switch rAuthType { switch rAuthType {
case authTypeStreamingSigned: case authTypeStreamingSigned:
@ -194,6 +195,7 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ
writeErrorResponse(w, s3ErrCode, r.URL) writeErrorResponse(w, s3ErrCode, r.URL)
return return
} }
}
defer dataReader.Close() defer dataReader.Close()
uploadUrl := fmt.Sprintf("http://%s%s/%s/%04d.part?collection=%s", uploadUrl := fmt.Sprintf("http://%s%s/%s/%04d.part?collection=%s",

Loading…
Cancel
Save