| 1 | // Copyright 2015 Matthew Holt and The Caddy Authors |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package fileserverscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/ |
| 16 | |
| 17 | import ( |
| 18 | "fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/" |
| 19 | "io/fsscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/" |
| 20 | "net/httpscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/" |
| 21 | "osscip-go gomod github.com/golang/go/src go1.25.1 os/" |
| 22 | "pathscip-go gomod github.com/golang/go/src go1.25.1 path/" |
| 23 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.1 `path/filepath`/" |
| 24 | "runtimescip-go gomod github.com/golang/go/src go1.25.1 runtime/" |
| 25 | "strconvscip-go gomod github.com/golang/go/src go1.25.1 strconv/" |
| 26 | "stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/" |
| 27 | |
| 28 | "github.com/google/cel-go/celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/" |
| 29 | "github.com/google/cel-go/commonscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common`/" |
| 30 | "github.com/google/cel-go/common/astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/" |
| 31 | "github.com/google/cel-go/common/operatorsscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/operators`/" |
| 32 | "github.com/google/cel-go/common/typesscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types`/" |
| 33 | "github.com/google/cel-go/common/types/refscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types/ref`/" |
| 34 | "github.com/google/cel-go/parserscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/" |
| 35 | "go.uber.org/zapscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/" |
| 36 | "go.uber.org/zap/zapcorescip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/" |
| 37 | |
| 38 | "github.com/caddyserver/caddy/v2scip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/" |
| 39 | "github.com/caddyserver/caddy/v2/caddyconfig/caddyfilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/" |
| 40 | "github.com/caddyserver/caddy/v2/modules/caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/" |
| 41 | ) |
| 42 | |
| 43 | func initscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/init().() { |
| 44 | caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.RegisterModulescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/RegisterModule().(MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#{}) |
| 45 | } |
| 46 | |
| 47 | // MatchFile is an HTTP request matcher that can match |
| 48 | // requests based upon file existence. |
| 49 | // |
| 50 | // Upon matching, three new placeholders will be made |
| 51 | // available: |
| 52 | // |
| 53 | // - `{http.matchers.file.relative}` The root-relative |
| 54 | // path of the file. This is often useful when rewriting |
| 55 | // requests. |
| 56 | // - `{http.matchers.file.absolute}` The absolute path |
| 57 | // of the matched file. |
| 58 | // - `{http.matchers.file.type}` Set to "directory" if |
| 59 | // the matched file is a directory, "file" otherwise. |
| 60 | // - `{http.matchers.file.remainder}` Set to the remainder |
| 61 | // of the path if the path was split by `split_path`. |
| 62 | // |
| 63 | // Even though file matching may depend on the OS path |
| 64 | // separator, the placeholder values always use /. |
| 65 | type MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile# struct { |
| 66 | // The file system implementation to use. By default, the |
| 67 | // local disk file system will be used. |
| 68 | FileSystemscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#FileSystem. string `json:"fs,omitempty"` |
| 69 | |
| 70 | // The root directory, used for creating absolute |
| 71 | // file paths, and required when working with |
| 72 | // relative paths; if not specified, `{http.vars.root}` |
| 73 | // will be used, if set; otherwise, the current |
| 74 | // directory is assumed. Accepts placeholders. |
| 75 | Rootscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#Root. string `json:"root,omitempty"` |
| 76 | |
| 77 | // The list of files to try. Each path here is |
| 78 | // considered related to Root. If nil, the request |
| 79 | // URL's path will be assumed. Files and |
| 80 | // directories are treated distinctly, so to match |
| 81 | // a directory, the filepath MUST end in a forward |
| 82 | // slash `/`. To match a regular file, there must |
| 83 | // be no trailing slash. Accepts placeholders. If |
| 84 | // the policy is "first_exist", then an error may |
| 85 | // be triggered as a fallback by configuring "=" |
| 86 | // followed by a status code number, |
| 87 | // for example "=404". |
| 88 | TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles. []string `json:"try_files,omitempty"` |
| 89 | |
| 90 | // How to choose a file in TryFiles. Can be: |
| 91 | // |
| 92 | // - first_exist |
| 93 | // - first_exist_fallback |
| 94 | // - smallest_size |
| 95 | // - largest_size |
| 96 | // - most_recently_modified |
| 97 | // |
| 98 | // Default is first_exist. |
| 99 | TryPolicyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryPolicy. string `json:"try_policy,omitempty"` |
| 100 | |
| 101 | // A list of delimiters to use to split the path in two |
| 102 | // when trying files. If empty, no splitting will |
| 103 | // occur, and the path will be tried as-is. For each |
| 104 | // split value, the left-hand side of the split, |
| 105 | // including the split value, will be the path tried. |
| 106 | // For example, the path `/remote.php/dav/` using the |
| 107 | // split value `.php` would try the file `/remote.php`. |
| 108 | // Each delimiter must appear at the end of a URI path |
| 109 | // component in order to be used as a split delimiter. |
| 110 | SplitPathscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#SplitPath. []string `json:"split_path,omitempty"` |
| 111 | |
| 112 | fsmapscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#fsmap. caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.FileSystemsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/FileSystems# |
| 113 | |
| 114 | loggerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#logger. *zapscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/.Loggerscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/Logger# |
| 115 | } |
| 116 | |
| 117 | // CaddyModule returns the Caddy module information. |
| 118 | func (MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#) CaddyModulescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#CaddyModule().() caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.ModuleInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ModuleInfo# { |
| 119 | return caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.ModuleInfoscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ModuleInfo#{ |
| 120 | IDscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ModuleInfo#ID.: "http.matchers.file", |
| 121 | Newscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ModuleInfo#New.: func() caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Modulescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Module# { return new(MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#) }, |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | // UnmarshalCaddyfile sets up the matcher from Caddyfile tokens. Syntax: |
| 126 | // |
| 127 | // file <files...> { |
| 128 | // root <path> |
| 129 | // try_files <files...> |
| 130 | // try_policy first_exist|smallest_size|largest_size|most_recently_modified |
| 131 | // } |
| 132 | func (m *MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#) UnmarshalCaddyfilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#UnmarshalCaddyfile().(d *caddyfilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/.Dispenserscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#) error { |
| 133 | // iterate to merge multiple matchers into one |
| 134 | for d.Nextscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Next().() { |
| 135 | m.TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles. = append(m.TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles., d.RemainingArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#RemainingArgs().()...) |
| 136 | for d.NextBlockscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextBlock().(0) { |
| 137 | switch d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().() { |
| 138 | case "root": |
| 139 | if !d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 140 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 141 | } |
| 142 | m.Rootscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#Root. = d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().() |
| 143 | case "try_files": |
| 144 | m.TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles. = append(m.TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles., d.RemainingArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#RemainingArgs().()...) |
| 145 | if len(m.TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles.) == 0 { |
| 146 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 147 | } |
| 148 | case "try_policy": |
| 149 | if !d.NextArgscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#NextArg().() { |
| 150 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 151 | } |
| 152 | m.TryPolicyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryPolicy. = d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().() |
| 153 | case "split_path": |
| 154 | m.SplitPathscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#SplitPath. = d.RemainingArgsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#RemainingArgs().() |
| 155 | if len(m.SplitPathscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#SplitPath.) == 0 { |
| 156 | return d.ArgErrscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#ArgErr().() |
| 157 | } |
| 158 | default: |
| 159 | return d.Errfscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Errf().("unrecognized subdirective: %s", d.Valscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/caddyconfig/caddyfile`/Dispenser#Val().()) |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | return nil |
| 164 | } |
| 165 | |
| 166 | // CELLibrary produces options that expose this matcher for use in CEL |
| 167 | // expression matchers. |
| 168 | // |
| 169 | // Example: |
| 170 | // |
| 171 | // expression file() |
| 172 | // expression file({http.request.uri.path}, '/index.php') |
| 173 | // expression file({'root': '/srv', 'try_files': [{http.request.uri.path}, '/index.php'], 'try_policy': 'first_exist', 'split_path': ['.php']}) |
| 174 | func (MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#) CELLibraryscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#CELLibrary().(ctx caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Contextscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Context#) (celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.Libraryscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/Library#, error) { |
| 175 | requestType := celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.ObjectTypescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/ObjectType.("http.Request") |
| 176 | |
| 177 | matcherFactory := func(data refscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types/ref`/Val#) (caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.RequestMatcherWithErrorscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/RequestMatcherWithError#, error) { |
| 178 | values, err := caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.CELValueToMapStrListscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/CELValueToMapStrList().(data) |
| 179 | if err != nil { |
| 180 | return nil, err |
| 181 | } |
| 182 | |
| 183 | var root string |
| 184 | if len(values["root"]) > 0 { |
| 185 | root = values["root"][0] |
| 186 | } |
| 187 | |
| 188 | var fsName string |
| 189 | if len(values["fs"]) > 0 { |
| 190 | fsName = values["fs"][0] |
| 191 | } |
| 192 | |
| 193 | var try_policy string |
| 194 | if len(values["try_policy"]) > 0 { |
| 195 | try_policy = values["try_policy"][0] |
| 196 | } |
| 197 | |
| 198 | m := MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#{ |
| 199 | Rootscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#Root.: root, |
| 200 | TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles.: values["try_files"], |
| 201 | TryPolicyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryPolicy.: try_policy, |
| 202 | SplitPathscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#SplitPath.: values["split_path"], |
| 203 | FileSystemscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#FileSystem.: fsName, |
| 204 | } |
| 205 | |
| 206 | err = m.Provisionscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#Provision().(ctx) |
| 207 | return m, err |
| 208 | } |
| 209 | |
| 210 | envOptions := []celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.EnvOptionscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/EnvOption#{ |
| 211 | celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.Macrosscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/Macros().(parserscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/.NewGlobalVarArgMacroscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/NewGlobalVarArgMacro().("file", celFileMatcherMacroExpanderscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/celFileMatcherMacroExpander().())), |
| 212 | celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.Functionscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/Function().("file", celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.Overloadscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/Overload().("file_request_map", []*celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.Typescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/Type#{requestType, caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.CELTypeJSONscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/CELTypeJSON.}, celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.BoolTypescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/BoolType.)), |
| 213 | celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.Functionscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/Function().("file_request_map", |
| 214 | celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.Overloadscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/Overload().("file_request_map", []*celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.Typescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/Type#{requestType, caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.CELTypeJSONscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/CELTypeJSON.}, celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.BoolTypescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/BoolType.), |
| 215 | celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.SingletonBinaryBindingscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/SingletonBinaryBinding().(caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.CELMatcherRuntimeFunctionscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/CELMatcherRuntimeFunction().("file_request_map", matcherFactory))), |
| 216 | } |
| 217 | |
| 218 | programOptions := []celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.ProgramOptionscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/ProgramOption#{ |
| 219 | celscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/.CustomDecoratorscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/cel`/CustomDecorator().(caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.CELMatcherDecoratorscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/CELMatcherDecorator().("file_request_map", matcherFactory)), |
| 220 | } |
| 221 | |
| 222 | return caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.NewMatcherCELLibraryscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/NewMatcherCELLibrary().(envOptions, programOptions), nil |
| 223 | } |
| 224 | |
| 225 | func celFileMatcherMacroExpanderscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/celFileMatcherMacroExpander().() parserscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/.MacroExpanderscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/MacroExpander# { |
| 226 | return func(eh parserscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/.ExprHelperscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#, target astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.Exprscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#, args []astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.Exprscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#) (astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.Exprscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#, *commonscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common`/.Errorscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common`/Error#) { |
| 227 | if len(args) == 0 { |
| 228 | return eh.NewCallscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewCall().("file", |
| 229 | eh.NewIdentscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewIdent().(caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.CELRequestVarNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/CELRequestVarName.), |
| 230 | eh.NewMapscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewMap().(), |
| 231 | ), nil |
| 232 | } |
| 233 | if len(args) == 1 { |
| 234 | arg := args[0] |
| 235 | if isCELStringLiteralscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELStringLiteral().(arg) || isCELCaddyPlaceholderCallscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELCaddyPlaceholderCall().(arg) { |
| 236 | return eh.NewCallscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewCall().("file", |
| 237 | eh.NewIdentscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewIdent().(caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.CELRequestVarNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/CELRequestVarName.), |
| 238 | eh.NewMapscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewMap().(eh.NewMapEntryscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewMapEntry().( |
| 239 | eh.NewLiteralscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewLiteral().(typesscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types`/.Stringscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types`/String#("try_files")), |
| 240 | eh.NewListscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewList().(arg), |
| 241 | false, |
| 242 | )), |
| 243 | ), nil |
| 244 | } |
| 245 | if isCELTryFilesLiteralscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELTryFilesLiteral().(arg) { |
| 246 | return eh.NewCallscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewCall().("file", eh.NewIdentscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewIdent().(caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.CELRequestVarNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/CELRequestVarName.), arg), nil |
| 247 | } |
| 248 | return nil, &commonscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common`/.Errorscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common`/Error#{ |
| 249 | Locationscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common`/Error#Location.: eh.OffsetLocationscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#OffsetLocation().(arg.IDscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#ID().()), |
| 250 | Messagescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common`/Error#Message.: "matcher requires either a map or string literal argument", |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | for _, arg := range args { |
| 255 | if !isCELStringLiteralscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELStringLiteral().(arg) && !isCELCaddyPlaceholderCallscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELCaddyPlaceholderCall().(arg) { |
| 256 | return nil, &commonscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common`/.Errorscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common`/Error#{ |
| 257 | Locationscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common`/Error#Location.: eh.OffsetLocationscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#OffsetLocation().(arg.IDscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#ID().()), |
| 258 | Messagescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common`/Error#Message.: "matcher only supports repeated string literal arguments", |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | return eh.NewCallscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewCall().("file", |
| 263 | eh.NewIdentscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewIdent().(caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.CELRequestVarNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/CELRequestVarName.), |
| 264 | eh.NewMapscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewMap().(eh.NewMapEntryscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewMapEntry().( |
| 265 | eh.NewLiteralscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewLiteral().(typesscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types`/.Stringscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types`/String#("try_files")), |
| 266 | eh.NewListscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/parser`/ExprHelper#NewList().(args...), |
| 267 | false, |
| 268 | )), |
| 269 | ), nil |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | // Provision sets up m's defaults. |
| 274 | func (m *MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#) Provisionscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#Provision().(ctx caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Contextscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Context#) error { |
| 275 | m.loggerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#logger. = ctx.Loggerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Context#Logger().() |
| 276 | |
| 277 | m.fsmapscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#fsmap. = ctx.FileSystemsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Context#FileSystems().() |
| 278 | |
| 279 | if m.Rootscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#Root. == "" { |
| 280 | m.Rootscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#Root. = "{http.vars.root}" |
| 281 | } |
| 282 | |
| 283 | if m.FileSystemscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#FileSystem. == "" { |
| 284 | m.FileSystemscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#FileSystem. = "{http.vars.fs}" |
| 285 | } |
| 286 | |
| 287 | // if list of files to try was omitted entirely, assume URL path |
| 288 | // (use placeholder instead of r.URL.Path; see issue #4146) |
| 289 | if m.TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles. == nil { |
| 290 | m.TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles. = []string{"{http.request.uri.path}"} |
| 291 | } |
| 292 | return nil |
| 293 | } |
| 294 | |
| 295 | // Validate ensures m has a valid configuration. |
| 296 | func (m MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#) Validatescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#Validate().() error { |
| 297 | switch m.TryPolicyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryPolicy. { |
| 298 | case "", |
| 299 | tryPolicyFirstExistscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyFirstExist., |
| 300 | tryPolicyFirstExistFallbackscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyFirstExistFallback., |
| 301 | tryPolicyLargestSizescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyLargestSize., |
| 302 | tryPolicySmallestSizescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicySmallestSize., |
| 303 | tryPolicyMostRecentlyModscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyMostRecentlyMod.: |
| 304 | default: |
| 305 | return fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("unknown try policy %s", m.TryPolicyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryPolicy.) |
| 306 | } |
| 307 | return nil |
| 308 | } |
| 309 | |
| 310 | // Match returns true if r matches m. Returns true |
| 311 | // if a file was matched. If so, four placeholders |
| 312 | // will be available: |
| 313 | // - http.matchers.file.relative: Path to file relative to site root |
| 314 | // - http.matchers.file.absolute: Path to file including site root |
| 315 | // - http.matchers.file.type: file or directory |
| 316 | // - http.matchers.file.remainder: Portion remaining after splitting file path (if configured) |
| 317 | func (m MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#) Matchscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#Match().(r *httpscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Request#) bool { |
| 318 | match, err := m.selectFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#selectFile().(r) |
| 319 | if err != nil { |
| 320 | // nolint:staticcheck |
| 321 | caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.SetVarscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/SetVar().(r.Contextscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Request#Context().(), caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.MatcherErrorVarKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/MatcherErrorVarKey., err) |
| 322 | } |
| 323 | return match |
| 324 | } |
| 325 | |
| 326 | // MatchWithError returns true if r matches m. |
| 327 | func (m MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#) MatchWithErrorscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#MatchWithError().(r *httpscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Request#) (bool, error) { |
| 328 | return m.selectFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#selectFile().(r) |
| 329 | } |
| 330 | |
| 331 | // selectFile chooses a file according to m.TryPolicy by appending |
| 332 | // the paths in m.TryFiles to m.Root, with placeholder replacements. |
| 333 | func (m MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#) selectFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#selectFile().(r *httpscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Request#) (bool, error) { |
| 334 | repl := r.Contextscip-go gomod github.com/golang/go/src go1.25.1 `net/http`/Request#Context().().Valuescip-go gomod github.com/golang/go/src go1.25.1 context/Context#Value().(caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.ReplacerCtxKeyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/ReplacerCtxKey.).(*caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Replacerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#) |
| 335 | |
| 336 | root := filepathscip-go gomod github.com/golang/go/src go1.25.1 `path/filepath`/.Cleanscip-go gomod github.com/golang/go/src go1.25.1 `path/filepath`/Clean().(repl.ReplaceAllscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#ReplaceAll().(m.Rootscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#Root., ".")) |
| 337 | |
| 338 | fsName := repl.ReplaceAllscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#ReplaceAll().(m.FileSystemscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#FileSystem., "") |
| 339 | |
| 340 | fileSystem, ok := m.fsmapscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#fsmap..Getscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/FileSystems#Get.(fsName) |
| 341 | if !ok { |
| 342 | if c := m.loggerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#logger..Checkscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/Logger#Check().(zapcorescip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/.ErrorLevelscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/ErrorLevel., "use of unregistered filesystem"); c != nil { |
| 343 | c.Writescip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/CheckedEntry#Write().(zapscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/.Stringscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/String().("fs", fsName)) |
| 344 | } |
| 345 | return false, nil |
| 346 | } |
| 347 | type matchCandidate struct { |
| 348 | fullpath, relative, splitRemainder string |
| 349 | } |
| 350 | |
| 351 | // makeCandidates evaluates placeholders in file and expands any glob expressions |
| 352 | // to build a list of file candidates. Special glob characters are escaped in |
| 353 | // placeholder replacements so globs cannot be expanded from placeholders, and |
| 354 | // globs are not evaluated on Windows because of its path separator character: |
| 355 | // escaping is not supported so we can't safely glob on Windows, or we can't |
| 356 | // support placeholders on Windows (pick one). (Actually, evaluating untrusted |
| 357 | // globs is not the end of the world since the file server will still hide any |
| 358 | // hidden files, it just might lead to unexpected behavior.) |
| 359 | makeCandidates := func(file string) []matchCandidate { |
| 360 | // first, evaluate placeholders in the file pattern |
| 361 | expandedFile, err := repl.ReplaceFuncscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#ReplaceFunc().(file, func(variable string, val any) (any, error) { |
| 362 | if runtimescip-go gomod github.com/golang/go/src go1.25.1 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.25.1 runtime/GOOS. == "windows" { |
| 363 | return val, nil |
| 364 | } |
| 365 | switch v := val.(type) { |
| 366 | case string: |
| 367 | return globSafeReplscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/globSafeRepl..Replacescip-go gomod github.com/golang/go/src go1.25.1 strings/Replacer#Replace().(v), nil |
| 368 | case fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Stringerscip-go gomod github.com/golang/go/src go1.25.1 fmt/Stringer#: |
| 369 | return globSafeReplscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/globSafeRepl..Replacescip-go gomod github.com/golang/go/src go1.25.1 strings/Replacer#Replace().(v.Stringscip-go gomod github.com/golang/go/src go1.25.1 fmt/Stringer#String().()), nil |
| 370 | } |
| 371 | return val, nil |
| 372 | }) |
| 373 | if err != nil { |
| 374 | if c := m.loggerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#logger..Checkscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/Logger#Check().(zapcorescip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/.ErrorLevelscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/ErrorLevel., "evaluating placeholders"); c != nil { |
| 375 | c.Writescip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/CheckedEntry#Write().(zapscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/.Errorscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/Error().(err)) |
| 376 | } |
| 377 | |
| 378 | expandedFile = file // "oh well," I guess? |
| 379 | } |
| 380 | |
| 381 | // clean the path and split, if configured -- we must split before |
| 382 | // globbing so that the file system doesn't include the remainder |
| 383 | // ("afterSplit") in the filename; be sure to restore trailing slash |
| 384 | beforeSplit, afterSplit := m.firstSplitscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#firstSplit().(pathscip-go gomod github.com/golang/go/src go1.25.1 path/.Cleanscip-go gomod github.com/golang/go/src go1.25.1 path/Clean().(expandedFile)) |
| 385 | if stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/.HasSuffixscip-go gomod github.com/golang/go/src go1.25.1 strings/HasSuffix().(file, "/") { |
| 386 | beforeSplit += "/" |
| 387 | } |
| 388 | |
| 389 | // create the full path to the file by prepending the site root |
| 390 | fullPattern := caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.SanitizedPathJoinscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/SanitizedPathJoin().(root, beforeSplit) |
| 391 | |
| 392 | // expand glob expressions, but not on Windows because Glob() doesn't |
| 393 | // support escaping on Windows due to path separator) |
| 394 | var globResults []string |
| 395 | if runtimescip-go gomod github.com/golang/go/src go1.25.1 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.25.1 runtime/GOOS. == "windows" { |
| 396 | globResults = []string{fullPattern} // precious Windows |
| 397 | } else { |
| 398 | globResults, err = fsscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/.Globscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/Glob().(fileSystem, fullPattern) |
| 399 | if err != nil { |
| 400 | if c := m.loggerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#logger..Checkscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/Logger#Check().(zapcorescip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/.ErrorLevelscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/ErrorLevel., "expanding glob"); c != nil { |
| 401 | c.Writescip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap/zapcore`/CheckedEntry#Write().(zapscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/.Errorscip-go gomod go.uber.org/zap v1.28.0 `go.uber.org/zap`/Error().(err)) |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | // for each glob result, combine all the forms of the path |
| 407 | candidates := make([]matchCandidate, 0, len(globResults)) |
| 408 | for _, result := range globResults { |
| 409 | candidates = append(candidates, matchCandidate{ |
| 410 | fullpath: result, |
| 411 | relative: stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.25.1 strings/TrimPrefix().(result, root), |
| 412 | splitRemainder: afterSplit, |
| 413 | }) |
| 414 | } |
| 415 | |
| 416 | return candidates |
| 417 | } |
| 418 | |
| 419 | // setPlaceholders creates the placeholders for the matched file |
| 420 | setPlaceholders := func(candidate matchCandidate, isDir bool) { |
| 421 | repl.Setscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#Set().("http.matchers.file.relative", filepathscip-go gomod github.com/golang/go/src go1.25.1 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.25.1 `path/filepath`/ToSlash().(candidate.relative)) |
| 422 | repl.Setscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#Set().("http.matchers.file.absolute", filepathscip-go gomod github.com/golang/go/src go1.25.1 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.25.1 `path/filepath`/ToSlash().(candidate.fullpath)) |
| 423 | repl.Setscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#Set().("http.matchers.file.remainder", filepathscip-go gomod github.com/golang/go/src go1.25.1 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.25.1 `path/filepath`/ToSlash().(candidate.splitRemainder)) |
| 424 | |
| 425 | fileType := "file" |
| 426 | if isDir { |
| 427 | fileType = "directory" |
| 428 | } |
| 429 | repl.Setscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Replacer#Set().("http.matchers.file.type", fileType) |
| 430 | } |
| 431 | |
| 432 | // match file according to the configured policy |
| 433 | switch m.TryPolicyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryPolicy. { |
| 434 | case "", tryPolicyFirstExistscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyFirstExist., tryPolicyFirstExistFallbackscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyFirstExistFallback.: |
| 435 | maxI := -1 |
| 436 | if m.TryPolicyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryPolicy. == tryPolicyFirstExistFallbackscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyFirstExistFallback. { |
| 437 | maxI = len(m.TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles.) - 1 |
| 438 | } |
| 439 | |
| 440 | for i, pattern := range m.TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles. { |
| 441 | // If the pattern is a status code, emit an error, |
| 442 | // which short-circuits the middleware pipeline and |
| 443 | // writes an HTTP error response. |
| 444 | if err := parseErrorCodescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/parseErrorCode().(pattern); err != nil { |
| 445 | return false, err |
| 446 | } |
| 447 | |
| 448 | candidates := makeCandidates(pattern) |
| 449 | for _, c := range candidates { |
| 450 | // Skip the IO if using fallback policy and it's the latest item |
| 451 | if i == maxI { |
| 452 | setPlaceholders(c, false) |
| 453 | |
| 454 | return true, nil |
| 455 | } |
| 456 | |
| 457 | if info, exists := m.strictFileExistsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#strictFileExists().(fileSystem, c.fullpath); exists { |
| 458 | setPlaceholders(c, info.IsDirscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FileInfo#IsDir().()) |
| 459 | return true, nil |
| 460 | } |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | case tryPolicyLargestSizescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyLargestSize.: |
| 465 | var largestSize int64 |
| 466 | var largest matchCandidate |
| 467 | var largestInfo osscip-go gomod github.com/golang/go/src go1.25.1 os/.FileInfoscip-go gomod github.com/golang/go/src go1.25.1 os/FileInfo# |
| 468 | for _, pattern := range m.TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles. { |
| 469 | candidates := makeCandidates(pattern) |
| 470 | for _, c := range candidates { |
| 471 | info, err := fsscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/.Statscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/Stat().(fileSystem, c.fullpath) |
| 472 | if err == nil && info.Sizescip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FileInfo#Size().() > largestSize { |
| 473 | largestSize = info.Sizescip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FileInfo#Size().() |
| 474 | largest = c |
| 475 | largestInfo = info |
| 476 | } |
| 477 | } |
| 478 | } |
| 479 | if largestInfo == nil { |
| 480 | return false, nil |
| 481 | } |
| 482 | setPlaceholders(largest, largestInfo.IsDirscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FileInfo#IsDir().()) |
| 483 | return true, nil |
| 484 | |
| 485 | case tryPolicySmallestSizescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicySmallestSize.: |
| 486 | var smallestSize int64 |
| 487 | var smallest matchCandidate |
| 488 | var smallestInfo osscip-go gomod github.com/golang/go/src go1.25.1 os/.FileInfoscip-go gomod github.com/golang/go/src go1.25.1 os/FileInfo# |
| 489 | for _, pattern := range m.TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles. { |
| 490 | candidates := makeCandidates(pattern) |
| 491 | for _, c := range candidates { |
| 492 | info, err := fsscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/.Statscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/Stat().(fileSystem, c.fullpath) |
| 493 | if err == nil && (smallestSize == 0 || info.Sizescip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FileInfo#Size().() < smallestSize) { |
| 494 | smallestSize = info.Sizescip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FileInfo#Size().() |
| 495 | smallest = c |
| 496 | smallestInfo = info |
| 497 | } |
| 498 | } |
| 499 | } |
| 500 | if smallestInfo == nil { |
| 501 | return false, nil |
| 502 | } |
| 503 | setPlaceholders(smallest, smallestInfo.IsDirscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FileInfo#IsDir().()) |
| 504 | return true, nil |
| 505 | |
| 506 | case tryPolicyMostRecentlyModscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyMostRecentlyMod.: |
| 507 | var recent matchCandidate |
| 508 | var recentInfo osscip-go gomod github.com/golang/go/src go1.25.1 os/.FileInfoscip-go gomod github.com/golang/go/src go1.25.1 os/FileInfo# |
| 509 | for _, pattern := range m.TryFilesscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#TryFiles. { |
| 510 | candidates := makeCandidates(pattern) |
| 511 | for _, c := range candidates { |
| 512 | info, err := fsscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/.Statscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/Stat().(fileSystem, c.fullpath) |
| 513 | if err == nil && |
| 514 | (recentInfo == nil || info.ModTimescip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FileInfo#ModTime().().Afterscip-go gomod github.com/golang/go/src go1.25.1 time/Time#After().(recentInfo.ModTimescip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FileInfo#ModTime().())) { |
| 515 | recent = c |
| 516 | recentInfo = info |
| 517 | } |
| 518 | } |
| 519 | } |
| 520 | if recentInfo == nil { |
| 521 | return false, nil |
| 522 | } |
| 523 | setPlaceholders(recent, recentInfo.IsDirscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FileInfo#IsDir().()) |
| 524 | return true, nil |
| 525 | } |
| 526 | |
| 527 | return false, nil |
| 528 | } |
| 529 | |
| 530 | // parseErrorCode checks if the input is a status |
| 531 | // code number, prefixed by "=", and returns an |
| 532 | // error if so. |
| 533 | func parseErrorCodescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/parseErrorCode().(input string) error { |
| 534 | if len(input) > 1 && input[0] == '=' { |
| 535 | code, err := strconvscip-go gomod github.com/golang/go/src go1.25.1 strconv/.Atoiscip-go gomod github.com/golang/go/src go1.25.1 strconv/Atoi().(input[1:]) |
| 536 | if err != nil || code < 100 || code > 999 { |
| 537 | return nil |
| 538 | } |
| 539 | return caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.Errorscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/Error().(code, fmtscip-go gomod github.com/golang/go/src go1.25.1 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.1 fmt/Errorf().("%s", input[1:])) |
| 540 | } |
| 541 | return nil |
| 542 | } |
| 543 | |
| 544 | // strictFileExists returns true if file exists |
| 545 | // and matches the convention of the given file |
| 546 | // path. If the path ends in a forward slash, |
| 547 | // the file must also be a directory; if it does |
| 548 | // NOT end in a forward slash, the file must NOT |
| 549 | // be a directory. |
| 550 | func (m MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#) strictFileExistsscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#strictFileExists().(fileSystem fsscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/.FSscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FS#, file string) (osscip-go gomod github.com/golang/go/src go1.25.1 os/.FileInfoscip-go gomod github.com/golang/go/src go1.25.1 os/FileInfo#, bool) { |
| 551 | info, err := fsscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/.Statscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/Stat().(fileSystem, file) |
| 552 | if err != nil { |
| 553 | // in reality, this can be any error |
| 554 | // such as permission or even obscure |
| 555 | // ones like "is not a directory" (when |
| 556 | // trying to stat a file within a file); |
| 557 | // in those cases we can't be sure if |
| 558 | // the file exists, so we just treat any |
| 559 | // error as if it does not exist; see |
| 560 | // https://stackoverflow.com/a/12518877/1048862 |
| 561 | return nil, false |
| 562 | } |
| 563 | if stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/.HasSuffixscip-go gomod github.com/golang/go/src go1.25.1 strings/HasSuffix().(file, separatorscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/separator.) { |
| 564 | // by convention, file paths ending |
| 565 | // in a path separator must be a directory |
| 566 | return info, info.IsDirscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FileInfo#IsDir().() |
| 567 | } |
| 568 | // by convention, file paths NOT ending |
| 569 | // in a path separator must NOT be a directory |
| 570 | return info, !info.IsDirscip-go gomod github.com/golang/go/src go1.25.1 `io/fs`/FileInfo#IsDir().() |
| 571 | } |
| 572 | |
| 573 | // firstSplit returns the first result where the path |
| 574 | // can be split in two by a value in m.SplitPath. The |
| 575 | // return values are the first piece of the path that |
| 576 | // ends with the split substring and the remainder. |
| 577 | // If the path cannot be split, the path is returned |
| 578 | // as-is (with no remainder). |
| 579 | func (m MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#) firstSplitscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#firstSplit().(path string) (splitPart, remainder string) { |
| 580 | for _, split := range m.SplitPathscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#SplitPath. { |
| 581 | if idx := indexFoldscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/indexFold().(path, split); idx > -1 { |
| 582 | pos := idx + len(split) |
| 583 | // skip the split if it's not the final part of the filename |
| 584 | if pos != len(path) && !stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.1 strings/HasPrefix().(path[pos:], "/") { |
| 585 | continue |
| 586 | } |
| 587 | return path[:pos], path[pos:] |
| 588 | } |
| 589 | } |
| 590 | return path, "" |
| 591 | } |
| 592 | |
| 593 | // There is no strings.IndexFold() function like there is strings.EqualFold(), |
| 594 | // but we can use strings.EqualFold() to build our own case-insensitive |
| 595 | // substring search (as of Go 1.14). |
| 596 | func indexFoldscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/indexFold().(haystack, needle string) int { |
| 597 | nlen := len(needle) |
| 598 | for i := 0; i+nlen < len(haystack); i++ { |
| 599 | if stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/.EqualFoldscip-go gomod github.com/golang/go/src go1.25.1 strings/EqualFold().(haystack[i:i+nlen], needle) { |
| 600 | return i |
| 601 | } |
| 602 | } |
| 603 | return -1 |
| 604 | } |
| 605 | |
| 606 | // isCELTryFilesLiteral returns whether the expression resolves to a map literal containing |
| 607 | // only string keys with or a placeholder call. |
| 608 | func isCELTryFilesLiteralscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELTryFilesLiteral().(e astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.Exprscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#) bool { |
| 609 | switch e.Kindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#Kind().() { |
| 610 | case astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.MapKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/MapKind.: |
| 611 | mapExpr := e.AsMapscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#AsMap().() |
| 612 | for _, entry := range mapExpr.Entriesscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/MapExpr#Entries().() { |
| 613 | mapKey := entry.AsMapEntryscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/EntryExpr#AsMapEntry().().Keyscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/MapEntry#Key().() |
| 614 | mapVal := entry.AsMapEntryscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/EntryExpr#AsMapEntry().().Valuescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/MapEntry#Value().() |
| 615 | if !isCELStringLiteralscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELStringLiteral().(mapKey) { |
| 616 | return false |
| 617 | } |
| 618 | mapKeyStr := mapKey.AsLiteralscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#AsLiteral().().ConvertToTypescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types/ref`/Val#ConvertToType().(typesscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types`/.StringTypescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types`/StringType.).Valuescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types/ref`/Val#Value().() |
| 619 | switch mapKeyStr { |
| 620 | case "try_files", "split_path": |
| 621 | if !isCELStringListLiteralscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELStringListLiteral().(mapVal) { |
| 622 | return false |
| 623 | } |
| 624 | case "try_policy", "root": |
| 625 | if !(isCELStringExprscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELStringExpr().(mapVal)) { |
| 626 | return false |
| 627 | } |
| 628 | default: |
| 629 | return false |
| 630 | } |
| 631 | } |
| 632 | return true |
| 633 | |
| 634 | case astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.UnspecifiedExprKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/UnspecifiedExprKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.CallKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/CallKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.ComprehensionKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/ComprehensionKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.IdentKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/IdentKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.ListKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/ListKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.LiteralKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/LiteralKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.SelectKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/SelectKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.StructKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/StructKind.: |
| 635 | // appeasing the linter :) |
| 636 | } |
| 637 | return false |
| 638 | } |
| 639 | |
| 640 | // isCELStringExpr indicates whether the expression is a supported string expression |
| 641 | func isCELStringExprscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELStringExpr().(e astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.Exprscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#) bool { |
| 642 | return isCELStringLiteralscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELStringLiteral().(e) || isCELCaddyPlaceholderCallscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELCaddyPlaceholderCall().(e) || isCELConcatCallscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELConcatCall().(e) |
| 643 | } |
| 644 | |
| 645 | // isCELStringLiteral returns whether the expression is a CEL string literal. |
| 646 | func isCELStringLiteralscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELStringLiteral().(e astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.Exprscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#) bool { |
| 647 | switch e.Kindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#Kind().() { |
| 648 | case astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.LiteralKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/LiteralKind.: |
| 649 | constant := e.AsLiteralscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#AsLiteral().() |
| 650 | switch constant.Typescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types/ref`/Val#Type().() { |
| 651 | case typesscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types`/.StringTypescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/types`/StringType.: |
| 652 | return true |
| 653 | } |
| 654 | case astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.UnspecifiedExprKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/UnspecifiedExprKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.CallKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/CallKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.ComprehensionKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/ComprehensionKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.IdentKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/IdentKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.ListKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/ListKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.MapKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/MapKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.SelectKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/SelectKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.StructKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/StructKind.: |
| 655 | // appeasing the linter :) |
| 656 | } |
| 657 | return false |
| 658 | } |
| 659 | |
| 660 | // isCELCaddyPlaceholderCall returns whether the expression is a caddy placeholder call. |
| 661 | func isCELCaddyPlaceholderCallscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELCaddyPlaceholderCall().(e astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.Exprscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#) bool { |
| 662 | switch e.Kindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#Kind().() { |
| 663 | case astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.CallKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/CallKind.: |
| 664 | call := e.AsCallscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#AsCall().() |
| 665 | if call.FunctionNamescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/CallExpr#FunctionName().() == caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.CELPlaceholderFuncNamescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/CELPlaceholderFuncName. { |
| 666 | return true |
| 667 | } |
| 668 | case astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.UnspecifiedExprKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/UnspecifiedExprKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.ComprehensionKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/ComprehensionKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.IdentKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/IdentKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.ListKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/ListKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.LiteralKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/LiteralKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.MapKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/MapKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.SelectKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/SelectKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.StructKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/StructKind.: |
| 669 | // appeasing the linter :) |
| 670 | } |
| 671 | return false |
| 672 | } |
| 673 | |
| 674 | // isCELConcatCall tests whether the expression is a concat function (+) with string, placeholder, or |
| 675 | // other concat call arguments. |
| 676 | func isCELConcatCallscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELConcatCall().(e astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.Exprscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#) bool { |
| 677 | switch e.Kindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#Kind().() { |
| 678 | case astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.CallKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/CallKind.: |
| 679 | call := e.AsCallscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#AsCall().() |
| 680 | if call.Targetscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/CallExpr#Target().().Kindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#Kind().() != astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.UnspecifiedExprKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/UnspecifiedExprKind. { |
| 681 | return false |
| 682 | } |
| 683 | if call.FunctionNamescip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/CallExpr#FunctionName().() != operatorsscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/operators`/.Addscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/operators`/Add. { |
| 684 | return false |
| 685 | } |
| 686 | for _, arg := range call.Argsscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/CallExpr#Args().() { |
| 687 | if !isCELStringExprscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELStringExpr().(arg) { |
| 688 | return false |
| 689 | } |
| 690 | } |
| 691 | return true |
| 692 | case astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.UnspecifiedExprKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/UnspecifiedExprKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.ComprehensionKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/ComprehensionKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.IdentKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/IdentKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.ListKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/ListKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.LiteralKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/LiteralKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.MapKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/MapKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.SelectKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/SelectKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.StructKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/StructKind.: |
| 693 | // appeasing the linter :) |
| 694 | } |
| 695 | return false |
| 696 | } |
| 697 | |
| 698 | // isCELStringListLiteral returns whether the expression resolves to a list literal |
| 699 | // containing only string constants or a placeholder call. |
| 700 | func isCELStringListLiteralscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELStringListLiteral().(e astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.Exprscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#) bool { |
| 701 | switch e.Kindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#Kind().() { |
| 702 | case astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.ListKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/ListKind.: |
| 703 | list := e.AsListscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/Expr#AsList().() |
| 704 | for _, elem := range list.Elementsscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/ListExpr#Elements().() { |
| 705 | if !isCELStringExprscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/isCELStringExpr().(elem) { |
| 706 | return false |
| 707 | } |
| 708 | } |
| 709 | return true |
| 710 | case astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.UnspecifiedExprKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/UnspecifiedExprKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.CallKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/CallKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.ComprehensionKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/ComprehensionKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.IdentKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/IdentKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.LiteralKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/LiteralKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.MapKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/MapKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.SelectKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/SelectKind., astscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/.StructKindscip-go gomod github.com/google/cel-go v0.28.1 `github.com/google/cel-go/common/ast`/StructKind.: |
| 711 | // appeasing the linter :) |
| 712 | } |
| 713 | return false |
| 714 | } |
| 715 | |
| 716 | // globSafeRepl replaces special glob characters with escaped |
| 717 | // equivalents. Note that the filepath godoc states that |
| 718 | // escaping is not done on Windows because of the separator. |
| 719 | var globSafeReplscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/globSafeRepl. = stringsscip-go gomod github.com/golang/go/src go1.25.1 strings/.NewReplacerscip-go gomod github.com/golang/go/src go1.25.1 strings/NewReplacer().( |
| 720 | "*", "\\*", |
| 721 | "[", "\\[", |
| 722 | "?", "\\?", |
| 723 | "\\", "\\\\", |
| 724 | ) |
| 725 | |
| 726 | const ( |
| 727 | tryPolicyFirstExistscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyFirstExist. = "first_exist" |
| 728 | tryPolicyFirstExistFallbackscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyFirstExistFallback. = "first_exist_fallback" |
| 729 | tryPolicyLargestSizescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyLargestSize. = "largest_size" |
| 730 | tryPolicySmallestSizescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicySmallestSize. = "smallest_size" |
| 731 | tryPolicyMostRecentlyModscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/tryPolicyMostRecentlyMod. = "most_recently_modified" |
| 732 | ) |
| 733 | |
| 734 | // Interface guards |
| 735 | var ( |
| 736 | _ caddyscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/.Validatorscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2`/Validator# = (*MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#)(nil) |
| 737 | _ caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.RequestMatcherWithErrorscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/RequestMatcherWithError# = (*MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#)(nil) |
| 738 | _ caddyhttpscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/.CELLibraryProducerscip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp`/CELLibraryProducer# = (*MatchFilescip-go gomod github.com/caddyserver/caddy/v2 . `github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver`/MatchFile#)(nil) |
| 739 | ) |