diff --git a/config/config.go b/config/config.go index fbdffc90..5ed11501 100644 --- a/config/config.go +++ b/config/config.go @@ -460,7 +460,7 @@ type Config struct { DisableKeepAlives bool `yaml:"disable_keep_alives"` MaxIdleConns int `yaml:"max_idle_conns,omitempty"` MaxIdleConnsPerHost int `yaml:"max_idle_conns_per_host,omitempty"` - MaxHeaderBytes int `yaml:"max_header_bytes"` + MaxRequestHeaderBytes int `yaml:"max_request_header_bytes"` KeepAlive100ContinueRequests bool `yaml:"keep_alive_100_continue_requests"` HTTPRewrite HTTPRewrite `yaml:"http_rewrite,omitempty"` diff --git a/config/config_test.go b/config/config_test.go index dcfb37e2..8965b005 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -213,13 +213,13 @@ status: }) It("sets MaxHeaderBytes", func() { var b = []byte(` -max_header_bytes: 10 +max_request_header_bytes: 10 `) err := config.Initialize(b) Expect(err).ToNot(HaveOccurred()) - Expect(config.MaxHeaderBytes).To(Equal(10)) + Expect(config.MaxRequestHeaderBytes).To(Equal(10)) }) It("sets prometheus endpoint config", func() { diff --git a/handlers/max_request_size.go b/handlers/max_request_size.go index 9700ca67..a64680bf 100644 --- a/handlers/max_request_size.go +++ b/handlers/max_request_size.go @@ -21,7 +21,7 @@ const ONE_MB = 1024 * 1024 // bytes * kb // NewAccessLog creates a new handler that handles logging requests to the // access log func NewMaxRequestSize(cfg *config.Config, logger *slog.Logger) *MaxRequestSize { - maxSize := cfg.MaxHeaderBytes + maxSize := cfg.MaxRequestHeaderBytes if maxSize < 1 { maxSize = ONE_MB diff --git a/handlers/max_request_size_test.go b/handlers/max_request_size_test.go index 863cce50..e4d87154 100644 --- a/handlers/max_request_size_test.go +++ b/handlers/max_request_size_test.go @@ -63,7 +63,7 @@ var _ = Describe("MaxRequestSize", func() { BeforeEach(func() { cfg = &config.Config{ - MaxHeaderBytes: 89, + MaxRequestHeaderBytes: 89, LoadBalance: config.LOAD_BALANCE_RR, StickySessionCookieNames: config.StringSet{"blarg": struct{}{}}, } @@ -216,7 +216,7 @@ var _ = Describe("MaxRequestSize", func() { Describe("NewMaxRequestSize()", func() { Context("when using a custom MaxHeaderBytes", func() { BeforeEach(func() { - cfg.MaxHeaderBytes = 1234 + cfg.MaxRequestHeaderBytes = 1234 }) It("returns a new requestSizeHandler using the provided size", func() { Expect(rh.MaxSize).To(Equal(1234)) @@ -225,7 +225,7 @@ var _ = Describe("MaxRequestSize", func() { Context("when using a negative MaxHeaderBytes", func() { BeforeEach(func() { - cfg.MaxHeaderBytes = -1 + cfg.MaxRequestHeaderBytes = -1 }) It("defaults to 1mb", func() { Expect(rh.MaxSize).To(Equal(1024 * 1024)) @@ -233,7 +233,7 @@ var _ = Describe("MaxRequestSize", func() { }) Context("when using a zero-value MaxHeaderBytes", func() { BeforeEach(func() { - cfg.MaxHeaderBytes = 0 + cfg.MaxRequestHeaderBytes = 0 }) It("defaults to 1mb", func() { Expect(rh.MaxSize).To(Equal(1024 * 1024)) @@ -242,7 +242,7 @@ var _ = Describe("MaxRequestSize", func() { Context("when using a >1mb MaxHeaderBytes", func() { BeforeEach(func() { - cfg.MaxHeaderBytes = handlers.ONE_MB * 2 + cfg.MaxRequestHeaderBytes = handlers.ONE_MB * 2 }) It("defaults to 1mb if the provided size", func() { Expect(rh.MaxSize).To(Equal(1024 * 1024)) diff --git a/integration/common_integration_test.go b/integration/common_integration_test.go index 171bd92c..6bb38907 100644 --- a/integration/common_integration_test.go +++ b/integration/common_integration_test.go @@ -137,7 +137,7 @@ func NewTestState() *testState { } cfg.OAuth.TokenEndpoint, cfg.OAuth.Port = hostnameAndPort(oauthServer.Addr()) - cfg.MaxHeaderBytes = 48 * 1024 //1kb + cfg.MaxRequestHeaderBytes = 48 * 1024 //1kb return &testState{ cfg: cfg, diff --git a/integration/large_request_test.go b/integration/large_request_test.go index 8a769dc8..90c314d1 100644 --- a/integration/large_request_test.go +++ b/integration/large_request_test.go @@ -25,7 +25,7 @@ var _ = Describe("Large requests", func() { testState = NewTestState() testState.EnableAccessLog() testState.EnableMetron() - testState.cfg.MaxHeaderBytes = 1 * 1024 // 1kb + testState.cfg.MaxRequestHeaderBytes = 1 * 1024 // 1kb testState.StartGorouterOrFail() appURL = "echo-app." + test_util.LocalhostDNS