From 7e719157d9b7002fc09de63344f7b4fdfa7e9f57 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 7 Dec 2020 14:22:47 -0700 Subject: httpcaddyfile: Decrement counter when removing conn policy (fix #3906) --- caddyconfig/httpcaddyfile/tlsapp.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'caddyconfig') diff --git a/caddyconfig/httpcaddyfile/tlsapp.go b/caddyconfig/httpcaddyfile/tlsapp.go index fe4c1b1..6a6e3ca 100644 --- a/caddyconfig/httpcaddyfile/tlsapp.go +++ b/caddyconfig/httpcaddyfile/tlsapp.go @@ -487,6 +487,7 @@ func consolidateAutomationPolicies(aps []*caddytls.AutomationPolicy) []*caddytls // remove or combine duplicate policies for i := 0; i < len(aps); i++ { + // compare only with next policies; we sorted by specificity so we must not delete earlier policies for j := i + 1; j < len(aps); j++ { // if they're exactly equal in every way, just keep one of them if reflect.DeepEqual(aps[i], aps[j]) { @@ -526,6 +527,7 @@ func consolidateAutomationPolicies(aps []*caddytls.AutomationPolicy) []*caddytls } } aps = append(aps[:j], aps[j+1:]...) + j-- } } } -- cgit v1.2.3