API: ListBuckets doesn't have a body, we should never read the body. (#2218)

ListBuckets was incorrectly reading the body of the request, fix it.
This commit is contained in:
Harshavardhana
2016-07-17 13:23:15 -07:00
committed by GitHub
parent aaf7803831
commit aeac902747
2 changed files with 31 additions and 43 deletions

View File

@@ -147,8 +147,23 @@ func isReqAuthenticated(r *http.Request) (s3Error APIErrorCode) {
return ErrAccessDenied
}
// authHandler - handles all the incoming authorization headers and
// validates them if possible.
// checkAuth - checks for conditions satisfying the authorization of
// the incoming request. Request should be either Presigned or Signed
// in accordance with AWS S3 Signature V4 requirements. ErrAccessDenied
// is returned for unhandled auth type. Once the auth type is indentified
// request headers and body are used to calculate the signature validating
// the client signature present in request.
func checkAuth(w http.ResponseWriter, r *http.Request) APIErrorCode {
authType := getRequestAuthType(r)
if authType != authTypePresigned && authType != authTypeSigned {
// For all unhandled auth types return error AccessDenied.
return ErrAccessDenied
}
// Validates the request for both Presigned and Signed.
return isReqAuthenticated(r)
}
// authHandler - handles all the incoming authorization headers and validates them if possible.
type authHandler struct {
handler http.Handler
}