diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2020-03-18 23:36:25 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2020-03-18 23:36:25 -0600 |
commit | afb2ca27c1b5464778c2e2c4ebf6f66337f98b30 (patch) | |
tree | cdbfb8c81126b4251492d56845ce46f2a2b0135b /modules/caddyhttp | |
parent | ce45353e619dfa364c7100fe1a4f7638a23b9745 (diff) |
caddyhttp: Minor improved Caddyfile support for some matchers
Simply allows the matcher to be specified multiple times in a set
which may be more convenient than one long line.
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r-- | modules/caddyhttp/matchers.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go index 988c92d..6bfb31e 100644 --- a/modules/caddyhttp/matchers.go +++ b/modules/caddyhttp/matchers.go @@ -135,7 +135,9 @@ func (MatchHost) CaddyModule() caddy.ModuleInfo { // UnmarshalCaddyfile implements caddyfile.Unmarshaler. func (m *MatchHost) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { - *m = d.RemainingArgs() + for d.Next() { + *m = append(*m, d.RemainingArgs()...) + } return nil } @@ -260,7 +262,7 @@ func (m MatchPath) Match(r *http.Request) bool { // UnmarshalCaddyfile implements caddyfile.Unmarshaler. func (m *MatchPath) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { for d.Next() { - *m = d.RemainingArgs() + *m = append(*m, d.RemainingArgs()...) } return nil } @@ -290,7 +292,7 @@ func (MatchMethod) CaddyModule() caddy.ModuleInfo { // UnmarshalCaddyfile implements caddyfile.Unmarshaler. func (m *MatchMethod) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { for d.Next() { - *m = d.RemainingArgs() + *m = append(*m, d.RemainingArgs()...) } return nil } @@ -622,7 +624,7 @@ func (MatchRemoteIP) CaddyModule() caddy.ModuleInfo { // UnmarshalCaddyfile implements caddyfile.Unmarshaler. func (m *MatchRemoteIP) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { for d.Next() { - m.Ranges = d.RemainingArgs() + m.Ranges = append(m.Ranges, d.RemainingArgs()...) } return nil } |