@@ -21,12 +21,17 @@ var httpClient = &http.Client{
2121// Config the plugin configuration.
2222type Config struct {
2323 ModSecurityUrl string `json:"modSecurityUrl,omitempty"`
24- MaxBodySize int64 `json:"maxBodySize,omitempty "`
24+ MaxBodySize int64 `json:"maxBodySize"`
2525}
2626
2727// CreateConfig creates the default plugin configuration.
2828func CreateConfig () * Config {
29- return & Config {}
29+ return & Config {
30+ // Safe default: if the max body size was not specified, use 10MB
31+ // Note that this will break any file upload with files > 10MB. Hopefully
32+ // the user will configure this parameter during the installation.
33+ MaxBodySize : 10 * 1024 * 1024 ,
34+ }
3035}
3136
3237// Modsecurity a Modsecurity plugin.
@@ -44,15 +49,9 @@ func New(ctx context.Context, next http.Handler, config *Config, name string) (h
4449 return nil , fmt .Errorf ("modSecurityUrl cannot be empty" )
4550 }
4651
47- // Safe default: if the max body size was not specified, use 10MB
48- // Note that this will break any file upload with files > 10MB. Hopefully
49- // the user will configure this parameter during the installation.
50- if config .MaxBodySize == 0 {
51- config .MaxBodySize = 10 * 1024 * 1024
52- }
53-
5452 return & Modsecurity {
5553 modSecurityUrl : config .ModSecurityUrl ,
54+ maxBodySize : config .MaxBodySize ,
5655 next : next ,
5756 name : name ,
5857 logger : log .New (os .Stdout , "" , log .LstdFlags ),
0 commit comments