diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-09-30 20:08:33 -0600 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-09-30 20:08:53 -0600 |
commit | 775c0c1040e6a6622fec39d49b354bfa194a6998 (patch) | |
tree | f46edde7ee0392ae714f4facfd4e64244814c040 /contrib/cgi/gemini.go | |
parent | 09c482d5016cfc7b628058893a1644fdf5fa699f (diff) |
file serving refactor
* do away with fs.FS usage in gemini, like the previous refactor in gopher
* remove spartan code in contrib
* standardize fsroot/urlroot string arguments to file serving handlers
Diffstat (limited to 'contrib/cgi/gemini.go')
-rw-r--r-- | contrib/cgi/gemini.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/cgi/gemini.go b/contrib/cgi/gemini.go index 1e97939..3ad407d 100644 --- a/contrib/cgi/gemini.go +++ b/contrib/cgi/gemini.go @@ -17,14 +17,14 @@ 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 GeminiCGIDirectory(pathRoot, fsRoot string) sr.Handler { - fsRoot = strings.TrimRight(fsRoot, "/") +func GeminiCGIDirectory(fsroot, urlroot string) sr.Handler { + fsroot = strings.TrimRight(fsroot, "/") return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response { - if !strings.HasPrefix(request.Path, pathRoot) { + if !strings.HasPrefix(request.Path, urlroot) { return nil } - filepath, pathinfo, err := ResolveCGI(request.Path[len(pathRoot):], fsRoot) + filepath, pathinfo, err := ResolveCGI(request.Path[len(urlroot):], fsroot) if err != nil { return gemini.Failure(err) } |