summaryrefslogtreecommitdiff
path: root/contrib/cgi/cgi.go
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/cgi/cgi.go')
-rw-r--r--contrib/cgi/cgi.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/cgi/cgi.go b/contrib/cgi/cgi.go
index 6a420b3..ab10622 100644
--- a/contrib/cgi/cgi.go
+++ b/contrib/cgi/cgi.go
@@ -110,7 +110,12 @@ func RunCGI(
}
basename := pathSegments[len(pathSegments)-1]
- scriptName := req.Path[:len(req.Path)-len(pathInfo)]
+ infoLen := len(pathInfo)
+ if pathInfo == "/" {
+ infoLen -= 1
+ }
+
+ scriptName := req.Path[:len(req.Path)-infoLen]
if strings.HasSuffix(scriptName, "/") {
scriptName = scriptName[:len(scriptName)-1]
}