Merge pull request #247 from DenBeke/master

fastcgi: Stripping PATH_INFO from SCRIPT_NAME
This commit is contained in:
Matt Holt 2015-09-28 14:33:27 -06:00
commit 79a7f8a460
2 changed files with 5 additions and 2 deletions

3
middleware/fastcgi/fastcgi.go Normal file → Executable file
View file

@ -166,6 +166,9 @@ func (h Handler) buildEnv(r *http.Request, rule Rule, fpath string) (map[string]
scriptFilename = absPath scriptFilename = absPath
} }
// Strip PATH_INFO from SCRIPT_NAME
scriptName = strings.TrimSuffix(scriptName, pathInfo)
// Get the request URI. The request URI might be as it came in over the wire, // Get the request URI. The request URI might be as it came in over the wire,
// or it might have been rewritten internally by the rewrite middleware (see issue #256). // or it might have been rewritten internally by the rewrite middleware (see issue #256).
// If it was rewritten, there will be a header indicating the original URL, // If it was rewritten, there will be a header indicating the original URL,

View file

@ -381,9 +381,9 @@ func (c *FCGIClient) Request(p map[string]string, req io.Reader) (resp *http.Res
return return
} }
if len(statusParts) > 1 { if len(statusParts) > 1 {
resp.Status = statusParts[1] resp.Status = statusParts[1]
} }
} else { } else {
resp.StatusCode = http.StatusOK resp.StatusCode = http.StatusOK
} }