From a69bd6fffa33c90cda4af8a43c384d65d850559b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 19 Nov 2024 01:00:48 +0100 Subject: [PATCH] rename --- modules/caddyhttp/fileserver/caddyfile.go | 2 +- modules/caddyhttp/fileserver/matcher.go | 18 +++++++++--------- .../reverseproxy/fastcgi/caddyfile.go | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/caddyhttp/fileserver/caddyfile.go b/modules/caddyhttp/fileserver/caddyfile.go index f61cd6630e9..86c26ea3515 100644 --- a/modules/caddyhttp/fileserver/caddyfile.go +++ b/modules/caddyhttp/fileserver/caddyfile.go @@ -274,7 +274,7 @@ func parseTryFiles(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error) tryPolicy = h.Val() switch tryPolicy { - case tryPolicyFirstExist, tryPolicyFirstExistOrFallback, tryPolicyLargestSize, tryPolicySmallestSize, tryPolicyMostRecentlyMod: + case tryPolicyFirstExist, tryPolicyFirstExistFallback, tryPolicyLargestSize, tryPolicySmallestSize, tryPolicyMostRecentlyMod: default: return nil, h.Errf("unrecognized try policy: %s", tryPolicy) } diff --git a/modules/caddyhttp/fileserver/matcher.go b/modules/caddyhttp/fileserver/matcher.go index f7b6b830f96..df144db2c88 100644 --- a/modules/caddyhttp/fileserver/matcher.go +++ b/modules/caddyhttp/fileserver/matcher.go @@ -90,7 +90,7 @@ type MatchFile struct { // How to choose a file in TryFiles. Can be: // // - first_exist - // - first_exist_or_fallback + // - first_exist_fallback // - smallest_size // - largest_size // - most_recently_modified @@ -430,9 +430,9 @@ func (m MatchFile) selectFile(r *http.Request) (bool, error) { // match file according to the configured policy switch m.TryPolicy { - case "", tryPolicyFirstExist, tryPolicyFirstExistOrFallback: + case "", tryPolicyFirstExist, tryPolicyFirstExistFallback: var maxI int - if m.TryPolicy == tryPolicyFirstExistOrFallback { + if m.TryPolicy == tryPolicyFirstExistFallback { maxI = len(m.TryFiles) - 1 } @@ -446,7 +446,7 @@ func (m MatchFile) selectFile(r *http.Request) (bool, error) { candidates := makeCandidates(pattern) for _, c := range candidates { - if m.TryPolicy == tryPolicyFirstExistOrFallback && i == maxI { + if m.TryPolicy == tryPolicyFirstExistFallback && i == maxI { setPlaceholders(c, false) return true, nil @@ -720,11 +720,11 @@ var globSafeRepl = strings.NewReplacer( ) const ( - tryPolicyFirstExist = "first_exist" - tryPolicyFirstExistOrFallback = "first_exist_or_fallback" - tryPolicyLargestSize = "largest_size" - tryPolicySmallestSize = "smallest_size" - tryPolicyMostRecentlyMod = "most_recently_modified" + tryPolicyFirstExist = "first_exist" + tryPolicyFirstExistFallback = "first_exist_fallback" + tryPolicyLargestSize = "largest_size" + tryPolicySmallestSize = "smallest_size" + tryPolicyMostRecentlyMod = "most_recently_modified" ) // Interface guards diff --git a/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go b/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go index d83637a2680..696d397e726 100644 --- a/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go +++ b/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go @@ -341,7 +341,7 @@ func parsePHPFastCGI(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error rewriteMatcherSet := caddy.ModuleMap{ "file": h.JSON(fileserver.MatchFile{ TryFiles: tryFiles, - TryPolicy: "first_exist_or_fallback", + TryPolicy: "first_exist_fallback", SplitPath: extensions, }), }