Skip to content

Commit

Permalink
Rolled back max header size cap
Browse files Browse the repository at this point in the history
  • Loading branch information
guscarreon committed May 2, 2024
1 parent 0929041 commit b214916
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ func (cfg *RequestLimits) validateAndLog() {
log.Fatalf("invalid config.request_limits.max_num_values: %d. Value cannot be negative.", cfg.MaxNumValues)
}

if cfg.MaxHeaderSize >= 0 && cfg.MaxHeaderSize <= http.DefaultMaxHeaderBytes {
if cfg.MaxHeaderSize >= 0 {
log.Infof("config.request_limits.max_header_size_bytes: %d", cfg.MaxHeaderSize)
} else {
log.Fatalf("invalid config.request_limits.max_header_size_bytes: %d. Value out of range.", cfg.MaxHeaderSize)
log.Fatalf("invalid config.request_limits.max_header_size_bytes: %d. Value cannot be negative.", cfg.MaxHeaderSize)
}
}

Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ func TestRequestLimitsValidateAndLog(t *testing.T) {
{msg: `config.request_limits.max_ttl_seconds: 0`, lvl: logrus.InfoLevel},
{msg: `config.request_limits.max_size_bytes: 0`, lvl: logrus.InfoLevel},
{msg: `config.request_limits.max_num_values: 0`, lvl: logrus.InfoLevel},
{msg: `invalid config.request_limits.max_header_size_bytes: -1. Value out of range.`, lvl: logrus.FatalLevel},
{msg: `invalid config.request_limits.max_header_size_bytes: -1. Value cannot be negative.`, lvl: logrus.FatalLevel},
},
expectFatal: true,
},
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func newAdminServer(cfg config.Configuration, handler http.Handler) *http.Server
Addr: ":" + strconv.Itoa(cfg.AdminPort),
Handler: handler,
}
if cfg.RequestLimits.MaxHeaderSize > 0 && cfg.RequestLimits.MaxHeaderSize < http.DefaultMaxHeaderBytes {
if cfg.RequestLimits.MaxHeaderSize > 0 {
server.MaxHeaderBytes = cfg.RequestLimits.MaxHeaderSize
}
return server
Expand Down

0 comments on commit b214916

Please sign in to comment.