Browse Source

fastcgi: Fix PATH_INFO (issue #3178)

master
Matthew Holt 5 years ago
parent
commit
235357abc8
No known key found for this signature in database GPG Key ID: 2A349DD577D586A5
  1. 6
      modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go

6
modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go

@ -173,8 +173,8 @@ func (t Transport) buildEnv(r *http.Request) (map[string]string, error) {
splitPos := t.splitPos(fpath) splitPos := t.splitPos(fpath)
// Request has the extension; path was split successfully // Request has the extension; path was split successfully
docURI := fpath[:splitPos+len(t.SplitPath)] docURI := fpath[:splitPos]
pathInfo := fpath[splitPos+len(t.SplitPath):] pathInfo := fpath[splitPos:]
scriptName := fpath scriptName := fpath
// Strip PATH_INFO from SCRIPT_NAME // Strip PATH_INFO from SCRIPT_NAME
@ -292,7 +292,7 @@ func (t Transport) splitPos(path string) int {
lowerPath := strings.ToLower(path) lowerPath := strings.ToLower(path)
for _, split := range t.SplitPath { for _, split := range t.SplitPath {
if idx := strings.Index(lowerPath, strings.ToLower(split)); idx > -1 { if idx := strings.Index(lowerPath, strings.ToLower(split)); idx > -1 {
return idx return idx + len(split)
} }
} }
return -1 return -1

Loading…
Cancel
Save