mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-26 10:13:39 +08:00
tls: No arguments to directive and no block is an error
This commit is contained in:
parent
c7d4d051cb
commit
8f2196c047
|
@ -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 New Issue
Block a user