@marcel91200 / caddy Mirror · read-only / commits / 1e8af273
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

fastcgi: Account for lack of split path configuration (fix #3221)

Matthew Holt committed Apr 3, 2020 at 10:25 UTC 1e8af2732946e39fe2821c8a63c2c9746d1672fc
1 file changed +8 -8
modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go
+8 -8
@@ -181,14 +181,14 @@ func (t Transport) buildEnv(r *http.Request) (map[string]string, error) {
181
182 fpath := r.URL.Path
183
184 - // Split path in preparation for env variables.
185 - // Previous canSplit checks ensure this can never be -1.
186 - // TODO: I haven't brought over canSplit from v1; make sure this doesn't break
187 - splitPos := t.splitPos(fpath)
188 -
189 - // Request has the extension; path was split successfully
190 - docURI := fpath[:splitPos]
191 - pathInfo := fpath[splitPos:]
184 + // split "actual path" from "path info" if configured
185 + var docURI, pathInfo string
186 + if splitPos := t.splitPos(fpath); splitPos > -1 {
187 + docURI = fpath[:splitPos]
188 + pathInfo = fpath[splitPos:]
189 + } else {
190 + docURI = fpath
191 + }
192 scriptName := fpath
193
194 // Strip PATH_INFO from SCRIPT_NAME