WithRequestSplitPath contains a list of split path strings. The path in the URL will be split into two, with the first piece ending with the value of splitPath. The first piece will be assumed as the actual resource (CGI script) name, and the second piece will be set to PATH_INFO for the CGI script
(splitPath []string)
| 83 | // which can be mitigated with use of a try_files-like behavior |
| 84 | // that 404s if the FastCGI path info is not found. |
| 85 | func WithRequestSplitPath(splitPath []string) (RequestOption, error) { |
| 86 | var b strings.Builder |
| 87 | |
| 88 | for i, split := range splitPath { |
| 89 | b.Grow(len(split)) |
| 90 | |
| 91 | for j := 0; j < len(split); j++ { |
| 92 | c := split[j] |
| 93 | if c >= utf8.RuneSelf { |
| 94 | return nil, ErrInvalidSplitPath |
| 95 | } |
| 96 | |
| 97 | if 'A' <= c && c <= 'Z' { |
| 98 | b.WriteByte(c + 'a' - 'A') |
| 99 | } else { |
| 100 | b.WriteByte(c) |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | splitPath[i] = b.String() |
| 105 | b.Reset() |
| 106 | } |
| 107 | |
| 108 | return func(o *frankenPHPContext) error { |
| 109 | o.splitPath = splitPath |
| 110 | |
| 111 | return nil |
| 112 | }, nil |
| 113 | } |
| 114 | |
| 115 | type PreparedEnv = map[string]string |
| 116 |