Skip to content
This repository was archived by the owner on May 27, 2019. It is now read-only.

Commit 920afe5

Browse files
committed
fix(router): BodySize config can be "0"
Setting size to 0 disables checking of client request body size. See http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
1 parent 4024db4 commit 920afe5

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

model/model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type RouterConfig struct {
4242
ServerNameHashMaxSize string `key:"serverNameHashMaxSize" constraint:"^[1-9]\\d*[kKmM]?$"`
4343
ServerNameHashBucketSize string `key:"serverNameHashBucketSize" constraint:"^[1-9]\\d*[kKmM]?$"`
4444
GzipConfig *GzipConfig `key:"gzip"`
45-
BodySize string `key:"bodySize" constraint:"^[1-9]\\d*[kKmM]?$"`
45+
BodySize string `key:"bodySize" constraint:"^[0-9]\\d*[kKmM]?$"`
4646
ProxyRealIPCIDRs []string `key:"proxyRealIpCidrs" constraint:"^((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\/([0-9]|[1-2][0-9]|3[0-2]))?(\\s*,\\s*)?)+$"`
4747
ErrorLogLevel string `key:"errorLogLevel" constraint:"^(info|notice|warn|error|crit|alert|emerg)$"`
4848
PlatformDomain string `key:"platformDomain" constraint:"(?i)^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}$"`

model/model_validation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestValidServerNameHashBucketSize(t *testing.T) {
6464
}
6565

6666
func TestInvalidBodySize(t *testing.T) {
67-
testInvalidValues(t, newTestRouterConfig, "BodySize", "bodySize", []string{"0", "-1", "foobar"})
67+
testInvalidValues(t, newTestRouterConfig, "BodySize", "bodySize", []string{"-1", "foobar"})
6868
}
6969

7070
func TestValidBodySize(t *testing.T) {

0 commit comments

Comments
 (0)