From c5fffb4ac2631f0b41a8e13b62925b9dc8346cb9 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Fri, 18 Mar 2022 17:08:23 -0400 Subject: caddyfile: Support for raw token values; improve `map`, `expression` (#4643) * caddyfile: Support for raw token values, improve `map`, `expression` * Applied code review comments * Rename RawVal to ValRaw Co-authored-by: Matthew Holt --- modules/caddyhttp/celmatcher.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules/caddyhttp/celmatcher.go') diff --git a/modules/caddyhttp/celmatcher.go b/modules/caddyhttp/celmatcher.go index d7d55d8..0306f39 100644 --- a/modules/caddyhttp/celmatcher.go +++ b/modules/caddyhttp/celmatcher.go @@ -150,7 +150,11 @@ func (m MatchExpression) Match(r *http.Request) bool { // UnmarshalCaddyfile implements caddyfile.Unmarshaler. func (m *MatchExpression) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { for d.Next() { - m.Expr = strings.Join(d.RemainingArgs(), " ") + if d.CountRemainingArgs() > 1 { + m.Expr = strings.Join(d.RemainingArgsRaw(), " ") + } else { + m.Expr = d.Val() + } } return nil } -- cgit v1.2.3