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)