summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/caddyhttp.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-07-11 22:02:47 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-07-11 22:02:47 -0600
commit9722dbe18a568b8229e07bafb6189a08fa3859e2 (patch)
tree74350f760c0a01432ad041e1427209412155be26 /modules/caddyhttp/caddyhttp.go
parent4698352b20872557e624c54c1b4a1e0074f0baca (diff)
Fix rehandling bug
Diffstat (limited to 'modules/caddyhttp/caddyhttp.go')
-rw-r--r--modules/caddyhttp/caddyhttp.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go
index ae73c98..467b40f 100644
--- a/modules/caddyhttp/caddyhttp.go
+++ b/modules/caddyhttp/caddyhttp.go
@@ -85,6 +85,10 @@ func (app *App) Provision(ctx caddy.Context) error {
return fmt.Errorf("setting up server error handling routes: %v", err)
}
}
+
+ if srv.MaxRehandles == nil {
+ srv.MaxRehandles = &DefaultMaxRehandles
+ }
}
return nil
@@ -111,8 +115,8 @@ func (app *App) Validate() error {
// each server's max rehandle value must be valid
for srvName, srv := range app.Servers {
- if srv.MaxRehandles < 0 {
- return fmt.Errorf("%s: invalid max_rehandles value: %d", srvName, srv.MaxRehandles)
+ if srv.MaxRehandles != nil && *srv.MaxRehandles < 0 {
+ return fmt.Errorf("%s: invalid max_rehandles value: %d", srvName, *srv.MaxRehandles)
}
}
@@ -435,6 +439,10 @@ const (
DefaultHTTPSPort = 443
)
+// DefaultMaxRehandles is the maximum number of rehandles to
+// allow, if not specified explicitly.
+var DefaultMaxRehandles = 3
+
// Interface guards
var (
_ caddy.App = (*App)(nil)