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.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/contrib/cgi/cgi.go b/contrib/cgi/cgi.go
index e43f1ef..7f88e57 100644
--- a/contrib/cgi/cgi.go
+++ b/contrib/cgi/cgi.go
@@ -13,6 +13,7 @@ import (
"os/exec"
"strings"
+ "tildegit.org/tjp/gus"
"tildegit.org/tjp/gus/gemini"
)
@@ -22,12 +23,12 @@ import (
// a request for /foo/bar/baz can also run an executable found at /foo or /foo/bar. In
// such a case the PATH_INFO environment variable will include the remaining portion of
// the URI path.
-func CGIDirectory(pathRoot, fsRoot string) gemini.Handler {
+func CGIDirectory(pathRoot, fsRoot string) gus.Handler {
fsRoot = strings.TrimRight(fsRoot, "/")
- return func(ctx context.Context, req *gemini.Request) *gemini.Response {
+ return func(ctx context.Context, req *gus.Request) *gus.Response {
if !strings.HasPrefix(req.Path, pathRoot) {
- return gemini.NotFound("Resource does not exist.")
+ return nil
}
path := req.Path[len(pathRoot):]
@@ -53,7 +54,7 @@ func CGIDirectory(pathRoot, fsRoot string) gemini.Handler {
}
}
- return gemini.NotFound("Resource does not exist.")
+ return nil
}
}
@@ -97,10 +98,10 @@ func isNotExistError(err error) bool {
// RunCGI runs a specific program as a CGI script.
func RunCGI(
ctx context.Context,
- req *gemini.Request,
+ req *gus.Request,
executable string,
pathInfo string,
-) *gemini.Response {
+) *gus.Response {
pathSegments := strings.Split(executable, "/")
dirPath := "."
@@ -139,7 +140,7 @@ func RunCGI(
func prepareCGIEnv(
ctx context.Context,
- req *gemini.Request,
+ req *gus.Request,
scriptName string,
pathInfo string,
) []string {