From 677e46a1e4dd3a752d949455afe8794bbc161aec Mon Sep 17 00:00:00 2001 From: darkweak Date: Thu, 8 Aug 2024 21:04:47 +0200 Subject: [PATCH] fix(traefik): use latest surrogate API --- plugins/caddy/httpcache_test.go | 1 - plugins/traefik/override/surrogate/providers/common.go | 2 +- .../darkweak/souin/pkg/surrogate/providers/akamai.go | 4 ++-- .../darkweak/souin/pkg/surrogate/providers/cloudflare.go | 4 ++-- .../darkweak/souin/pkg/surrogate/providers/common.go | 2 +- .../darkweak/souin/pkg/surrogate/providers/types.go | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/plugins/caddy/httpcache_test.go b/plugins/caddy/httpcache_test.go index 1cf283b09..4072c1673 100644 --- a/plugins/caddy/httpcache_test.go +++ b/plugins/caddy/httpcache_test.go @@ -1046,4 +1046,3 @@ func (t *testCancelHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { time.Sleep(time.Second) _, _ = w.Write([]byte("Hello, cancel-handler!")) } -*/ diff --git a/plugins/traefik/override/surrogate/providers/common.go b/plugins/traefik/override/surrogate/providers/common.go index b6ccc973f..5ae49c91b 100644 --- a/plugins/traefik/override/surrogate/providers/common.go +++ b/plugins/traefik/override/surrogate/providers/common.go @@ -189,7 +189,7 @@ func (s *baseStorage) purgeTag(tag string) []string { } // Store will take the lead to store the cache key for each provided Surrogate-key -func (s *baseStorage) Store(response *http.Response, cacheKey string) error { +func (s *baseStorage) Store(response *http.Response, cacheKey, uri, basekey string) error { h := response.Header cacheKey = url.QueryEscape(cacheKey) diff --git a/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/akamai.go b/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/akamai.go index 2e35a9564..d33455b79 100644 --- a/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/akamai.go +++ b/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/akamai.go @@ -39,12 +39,12 @@ func (*AkamaiSurrogateStorage) getHeaderSeparator() string { } // Store stores the response tags located in the first non empty supported header -func (a *AkamaiSurrogateStorage) Store(response *http.Response, cacheKey string) error { +func (a *AkamaiSurrogateStorage) Store(response *http.Response, cacheKey, uri, basekey string) error { defer func() { response.Header.Del(surrogateKey) response.Header.Del(surrogateControl) }() - e := a.baseStorage.Store(response, cacheKey) + e := a.baseStorage.Store(response, cacheKey, uri, basekey) response.Header.Set(edgeCacheTag, response.Header.Get(surrogateKey)) return e diff --git a/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/cloudflare.go b/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/cloudflare.go index f131ac900..d733347b8 100644 --- a/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/cloudflare.go +++ b/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/cloudflare.go @@ -38,12 +38,12 @@ func (*CloudflareSurrogateStorage) getHeaderSeparator() string { } // Store stores the response tags located in the first non empty supported header -func (c *CloudflareSurrogateStorage) Store(response *http.Response, cacheKey string) error { +func (c *CloudflareSurrogateStorage) Store(response *http.Response, cacheKey, uri, basekey string) error { defer func() { response.Header.Del(surrogateKey) response.Header.Del(surrogateControl) }() - e := c.baseStorage.Store(response, cacheKey) + e := c.baseStorage.Store(response, cacheKey, uri, basekey) response.Header.Set(cacheTag, strings.Join(c.ParseHeaders(response.Header.Get(surrogateKey)), c.getHeaderSeparator())) return e diff --git a/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/common.go b/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/common.go index b6ccc973f..5ae49c91b 100644 --- a/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/common.go +++ b/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/common.go @@ -189,7 +189,7 @@ func (s *baseStorage) purgeTag(tag string) []string { } // Store will take the lead to store the cache key for each provided Surrogate-key -func (s *baseStorage) Store(response *http.Response, cacheKey string) error { +func (s *baseStorage) Store(response *http.Response, cacheKey, uri, basekey string) error { h := response.Header cacheKey = url.QueryEscape(cacheKey) diff --git a/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/types.go b/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/types.go index 31c8e4666..999fe90ff 100644 --- a/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/types.go +++ b/plugins/traefik/vendor/github.com/darkweak/souin/pkg/surrogate/providers/types.go @@ -16,7 +16,7 @@ type SurrogateInterface interface { Purge(http.Header) (cacheKeys []string, surrogateKeys []string) Invalidate(method string, h http.Header) purgeTag(string) []string - Store(*http.Response, string) error + Store(*http.Response, string, string, string) error storeTag(string, string, *regexp.Regexp) ParseHeaders(string) []string List() map[string]string