0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

tls: No arguments to directive and no block is an error

This commit is contained in:
Matthew Holt 2016-01-12 08:52:43 -07:00
parent c7d4d051cb
commit 8f2196c047

View file

@ -34,7 +34,9 @@ func TLS(c *Controller) (middleware.Middleware, error) {
}
// Optional block with extra parameters
var hadBlock bool
for c.NextBlock() {
hadBlock = true
switch c.Val() {
case "protocols":
args := c.RemainingArgs()
@ -71,6 +73,11 @@ func TLS(c *Controller) (middleware.Middleware, error) {
return nil, c.Errf("Unknown keyword '%s'", c.Val())
}
}
// tls requires at least one argument if a block is not opened
if len(args) == 0 && !hadBlock {
return nil, c.ArgErr()
}
}
SetDefaultTLSParams(c.Config)