summaryrefslogtreecommitdiff
path: root/contrib/cgi
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-01-23 22:15:16 -0700
committertjpcc <tjp@ctrl-c.club>2023-01-23 22:15:16 -0700
commit0480e066a3f1ae97dbab8fcb6303589eb0fa724c (patch)
tree1aa347eb3691a29987475fcf6049343aa227a365 /contrib/cgi
parentdf57a12539030297b3254bc81f5696691cbc9c6f (diff)
logging library up to top level
Diffstat (limited to 'contrib/cgi')
-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]
}