MCPcopy Index your code
hub / github.com/php/frankenphp / WithRequestSplitPath

Function WithRequestSplitPath

requestoptions.go:85–113  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

83// which can be mitigated with use of a try_files-like behavior
84// that 404s if the FastCGI path info is not found.
85func 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
115type PreparedEnv = map[string]string
116

Callers 2

ProvisionMethod · 0.92
TestWithRequestSplitPathFunction · 0.85

Calls 2

ResetMethod · 0.80
StringMethod · 0.45

Tested by 1

TestWithRequestSplitPathFunction · 0.68