move max_request_size from agent to server (#1145)

moves the config option for max request size up to the front end, adds the env
var for it there, adds a server test for it and removes it from agent. a
request is either gonna come through the lb (before grpc) or to the server, we
can handle limiting the request there at least now, which may be easier than
having multiple layers of request body checking. this aligns with not making
the agent as responsible for http behaviors (eventually, not at all once route
is fully deprecated).
This commit is contained in:
Reed Allman
2018-07-31 08:58:47 -07:00
committed by GitHub
parent 0cde57bdab
commit af94f3f8ac
7 changed files with 54 additions and 81 deletions

View File

@@ -51,7 +51,9 @@ func EnableShutdownEndpoint(ctx context.Context, halt context.CancelFunc) Option
// LimitRequestBody wraps every http request to limit its size to the specified max bytes.
func LimitRequestBody(max int64) Option {
return func(ctx context.Context, s *Server) error {
s.Router.Use(limitRequestBody(max))
if max > 0 {
s.Router.Use(limitRequestBody(max))
}
return nil
}
}