Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Nov 19, 2024
1 parent 381d5e8 commit a69bd6f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion modules/caddyhttp/fileserver/caddyfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
18 changes: 9 additions & 9 deletions modules/caddyhttp/fileserver/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
}
Expand Down

0 comments on commit a69bd6f

Please sign in to comment.