@marcel91200 / caddy Mirror · read-only / commits / f4432a30
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 02:00 UTC

caddyfile: add error handling for unrecognized subdirective/options in various modules (#6884)

Steffen Busch committed Mar 8, 2025 at 21:45 UTC f4432a306ac59feee1fc45c8efefad3619e37629
5 files changed +13
caddyconfig/httpcaddyfile/serveroptions.go
+2
@@ -246,6 +246,8 @@ func unmarshalCaddyfileServerOptions(d *caddyfile.Dispenser) (any, error) {
246 switch d.Val() {
247 case "per_host":
248 serverOpts.Metrics.PerHost = true
249 + default:
250 + return nil, d.Errf("unrecognized metrics option '%s'", d.Val())
251 }
252 }
253
modules/caddyhttp/matchers.go
+2
@@ -1342,6 +1342,8 @@ func (m *MatchTLS) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
1342 case "early_data":
1343 var false bool
1344 m.HandshakeComplete = &false
1345 + default:
1346 + return d.Errf("unrecognized option '%s'", d.Val())
1347 }
1348 }
1349 if d.NextArg() {
modules/caddytls/internalissuer.go
+3
@@ -178,6 +178,9 @@ func (iss *InternalIssuer) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
178 return d.ArgErr()
179 }
180 iss.SignWithRoot = true
181 +
182 + default:
183 + return d.Errf("unrecognized subdirective '%s'", d.Val())
184 }
185 }
186 return nil
modules/logging/filewriter.go
+3
@@ -313,6 +313,9 @@ func (fw *FileWriter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
313 return d.Errf("negative roll_keep_for duration: %v", keepFor)
314 }
315 fw.RollKeepDays = int(math.Ceil(keepFor.Hours() / 24))
316 +
317 + default:
318 + return d.Errf("unrecognized subdirective '%s'", d.Val())
319 }
320 }
321 return nil
modules/logging/netwriter.go
+3
@@ -145,6 +145,9 @@ func (nw *NetWriter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
145 return d.ArgErr()
146 }
147 nw.SoftStart = true
148 +
149 + default:
150 + return d.Errf("unrecognized subdirective '%s'", d.Val())
151 }
152 }
153 return nil