summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/push
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/push')
-rw-r--r--modules/caddyhttp/push/caddyfile.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/modules/caddyhttp/push/caddyfile.go b/modules/caddyhttp/push/caddyfile.go
index a70d5d5..61b868c 100644
--- a/modules/caddyhttp/push/caddyfile.go
+++ b/modules/caddyhttp/push/caddyfile.go
@@ -59,6 +59,8 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
return nil, h.ArgErr()
}
for innerNesting := h.Nesting(); h.NextBlock(innerNesting); {
+ var err error
+
// include current token, which we treat as an argument here
args := []string{h.Val()}
args = append(args, h.RemainingArgs()...)
@@ -66,16 +68,21 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
if handler.Headers == nil {
handler.Headers = new(HeaderConfig)
}
+
switch len(args) {
case 1:
- headers.CaddyfileHeaderOp(&handler.Headers.HeaderOps, args[0], "", "")
+ err = headers.CaddyfileHeaderOp(&handler.Headers.HeaderOps, args[0], "", "")
case 2:
- headers.CaddyfileHeaderOp(&handler.Headers.HeaderOps, args[0], args[1], "")
+ err = headers.CaddyfileHeaderOp(&handler.Headers.HeaderOps, args[0], args[1], "")
case 3:
- headers.CaddyfileHeaderOp(&handler.Headers.HeaderOps, args[0], args[1], args[2])
+ err = headers.CaddyfileHeaderOp(&handler.Headers.HeaderOps, args[0], args[1], args[2])
default:
return nil, h.ArgErr()
}
+
+ if err != nil {
+ return nil, h.Err(err.Error())
+ }
}
case "GET", "HEAD":