mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-13 22:51:08 -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
|
// Optional block with extra parameters
|
||||||
|
var hadBlock bool
|
||||||
for c.NextBlock() {
|
for c.NextBlock() {
|
||||||
|
hadBlock = true
|
||||||
switch c.Val() {
|
switch c.Val() {
|
||||||
case "protocols":
|
case "protocols":
|
||||||
args := c.RemainingArgs()
|
args := c.RemainingArgs()
|
||||||
|
@ -71,6 +73,11 @@ func TLS(c *Controller) (middleware.Middleware, error) {
|
||||||
return nil, c.Errf("Unknown keyword '%s'", c.Val())
|
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)
|
SetDefaultTLSParams(c.Config)
|
||||||
|
|
Loading…
Reference in a new issue