restirct max size of http header and user metadata (#4634) (#4680)

S3 only allows http headers with a size of 8 KB and user-defined metadata
with a size of 2 KB. This change adds a new API error and returns this
error to clients which sends to large http requests.

Fixes #4634
This commit is contained in:
Andreas Auernhammer
2017-08-22 16:53:35 -07:00
committed by Dee Koder
parent b694c1a4d7
commit 3a73c675a6
5 changed files with 102 additions and 6 deletions

View File

@@ -116,6 +116,7 @@ const (
ErrInvalidDuration
ErrNotSupported
ErrBucketAlreadyExists
ErrMetadataTooLarge
// Add new error codes here.
// Bucket notification related errors.
@@ -630,7 +631,11 @@ var errorCodeResponse = map[APIErrorCode]APIError{
Description: "Cannot respond to plain-text request from TLS-encrypted server",
HTTPStatusCode: http.StatusBadRequest,
},
ErrMetadataTooLarge: {
Code: "InvalidArgument",
Description: "Your metadata headers exceed the maximum allowed metadata size.",
HTTPStatusCode: http.StatusBadRequest,
},
// Add your error structure here.
}