From 0480e066a3f1ae97dbab8fcb6303589eb0fa724c Mon Sep 17 00:00:00 2001 From: tjpcc Date: Mon, 23 Jan 2023 22:15:16 -0700 Subject: logging library up to top level --- contrib/cgi/cgi.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'contrib/cgi/cgi.go') 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] } -- cgit v1.2.3