Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
Fix error handling with Validate when loading modules (fixes #2658)
The return statement was improperly nested in context.go
Matthew Holt committed
Jul 7, 2019 at 14:12 UTC
42acdad9e541192185fe2ce64e72430ab032ca16
3 files changed
+14
-6
context.go
+1
-1
@@ -138,8 +138,8 @@ func (ctx Context) LoadModule(name string, rawMsg json.RawMessage) (interface{},
138
if err2 != nil {
139
err = fmt.Errorf("%v; additionally, cleanup: %v", err, err2)
140
}
141
- return nil, fmt.Errorf("%s: invalid configuration: %v", mod.Name, err)
141
}
142
+ return nil, fmt.Errorf("%s: invalid configuration: %v", mod.Name, err)
143
}
144
}
145
modules/caddyhttp/caddyhttp.go
+7
-3
@@ -102,7 +102,7 @@ func (app *App) Validate() error {
102
}
103
for _, a := range expanded {
104
if sn, ok := lnAddrs[netw+a]; ok {
105
- return fmt.Errorf("listener address repeated: %s (already claimed by server '%s')", a, sn)
105
+ return fmt.Errorf("server %s: listener address repeated: %s (already claimed by server '%s')", srvName, a, sn)
106
}
107
lnAddrs[netw+a] = srvName
108
}
@@ -486,5 +486,9 @@ const (
486
DefaultHTTPSPort = 443
487
)
488
489
-// Interface guard
490
-var _ caddy.App = (*App)(nil)
489
+// Interface guards
490
+var (
491
+ _ caddy.App = (*App)(nil)
492
+ _ caddy.Provisioner = (*App)(nil)
493
+ _ caddy.Validator = (*App)(nil)
494
+)
modules/caddyhttp/fileserver/staticfiles.go
+6
-2
@@ -450,5 +450,9 @@ var defaultIndexNames = []string{"index.html"}
450
451
const minBackoff, maxBackoff = 2, 5
452
453
-// Interface guard
454
-var _ caddyhttp.Handler = (*FileServer)(nil)
453
+// Interface guards
454
+var (
455
+ _ caddy.Provisioner = (*FileServer)(nil)
456
+ _ caddy.Validator = (*FileServer)(nil)
457
+ _ caddyhttp.Handler = (*FileServer)(nil)
458
+)