fastcgi: Case-insensitive extension comparison

This commit is contained in:
MisterDuval 2019-11-15 20:54:39 +01:00 committed by Matt Holt
parent cc63eca0c8
commit 832df649c1

View file

@ -102,7 +102,8 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
}
// These criteria work well in this order for PHP sites
if !h.exists(fpath) || fpath[len(fpath)-1] == '/' || strings.HasSuffix(fpath, rule.Ext) {
// We lower path and Ext as on Windows, the system is case insensitive, so .PHP is served as .php
if !h.exists(fpath) || fpath[len(fpath)-1] == '/' || strings.HasSuffix(strings.ToLower(fpath), strings.ToLower(rule.Ext)) {
// Create environment for CGI script
env, err := h.buildEnv(r, rule, fpath)