Commit 8f2196c0 authored by Matthew Holt's avatar Matthew Holt

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

parent c7d4d051
...@@ -34,7 +34,9 @@ func TLS(c *Controller) (middleware.Middleware, error) { ...@@ -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) { ...@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment