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:
parent
c7d4d051cb
commit
8f2196c047
1 changed files with 7 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue