From baf1c1638d0dbbf8214e7c4ba7dcdc0dd5be155c Mon Sep 17 00:00:00 2001 From: Bala FA Date: Tue, 22 Nov 2016 19:58:51 -0800 Subject: [PATCH] server: set maximum allowed request body. (#3324) This patch sets the value as 5GiB + 64MiB. 5GiB is the maximum allowed object size and 64MiB is for form data fields and headers. --- cmd/generic-handlers.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/generic-handlers.go b/cmd/generic-handlers.go index a84f9c66e..b657edeca 100644 --- a/cmd/generic-handlers.go +++ b/cmd/generic-handlers.go @@ -42,9 +42,13 @@ func registerHandlers(mux *router.Router, handlerFns ...HandlerFunc) http.Handle // Adds limiting body size middleware -// Set the body size limit to 6 Gb = Maximum object size + other possible data -// in the same request -const requestMaxBodySize = (5 + 1) * humanize.GiByte +// Maximum allowed form data field values. 64MiB is a guessed practical value +// which is more than enough to accommodate any form data fields and headers. +const requestFormDataSize = 64 * humanize.MiByte + +// For any HTTP request, request body should be not more than 5GiB + requestFormDataSize +// where, 5GiB is the maximum allowed object size for object upload. +const requestMaxBodySize = 5*humanize.GiByte + requestFormDataSize type requestSizeLimitHandler struct { handler http.Handler