summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/map
diff options
context:
space:
mode:
authorMatt Holt <mholt@users.noreply.github.com>2022-09-29 12:46:38 -0600
committerGitHub <noreply@github.com>2022-09-29 12:46:38 -0600
commit5e52bbb1369b7444700427539e4dd532ed13ac6d (patch)
tree8a7016ab99d10c2157298bca7d4076969d332122 /modules/caddyhttp/map
parentfcdbc69fabd14c6d0b1fe5c5e07490bf27d7f8bd (diff)
map: Remove infinite recursion check (#5094)
It was not accurate. Placeholders could be used in outputs that are defined in the same mapping as long as that placeholder does not do the same. A more general solution would be to detect it at run-time in the replacer directly, but that's a bit tedious and will require allocations I think. A better implementation of this check could still be done, but I don't know if it would always be accurate. Could be a "best-effort" thing? But I've also never heard of an actual case where someone configured infinite recursion...
Diffstat (limited to 'modules/caddyhttp/map')
-rw-r--r--modules/caddyhttp/map/map.go11
1 files changed, 1 insertions, 10 deletions
diff --git a/modules/caddyhttp/map/map.go b/modules/caddyhttp/map/map.go
index b972534..fbd1e40 100644
--- a/modules/caddyhttp/map/map.go
+++ b/modules/caddyhttp/map/map.go
@@ -109,22 +109,13 @@ func (h *Handler) Validate() error {
}
seen[input] = i
- // prevent infinite recursion
- for _, out := range m.Outputs {
- for _, dest := range h.Destinations {
- if strings.Contains(caddy.ToString(out), dest) ||
- strings.Contains(m.Input, dest) {
- return fmt.Errorf("mapping %d requires value of {%s} to define value of {%s}: infinite recursion", i, dest, dest)
- }
- }
- }
-
// ensure mappings have 1:1 output-to-destination correspondence
nOut := len(m.Outputs)
if nOut != nDest {
return fmt.Errorf("mapping %d has %d outputs but there are %d destinations defined", i, nOut, nDest)
}
}
+
return nil
}