summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/cgi/cgi.go7
-rw-r--r--contrib/log/log.go35
-rw-r--r--contrib/tlsauth/auth_test.go1
3 files changed, 7 insertions, 36 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]
}
diff --git a/contrib/log/log.go b/contrib/log/log.go
deleted file mode 100644
index 0060f4e..0000000
--- a/contrib/log/log.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package log
-
-import (
- "context"
- "io"
- "time"
-
- kitlog "github.com/go-kit/log"
-
- "tildegit.org/tjp/gus"
-)
-
-func Requests(out io.Writer, logger kitlog.Logger) gus.Middleware {
- if logger == nil {
- logger = kitlog.NewLogfmtLogger(kitlog.NewSyncWriter(out))
- }
-
- return func(next gus.Handler) gus.Handler {
- return func(ctx context.Context, r *gus.Request) (resp *gus.Response) {
- start := time.Now()
- defer func() {
- end := time.Now()
- logger.Log(
- "msg", "request",
- "ts", end,
- "dur", end.Sub(start),
- "url", r.URL,
- "status", resp.Status,
- )
- }()
-
- return next(ctx, r)
- }
- }
-}
diff --git a/contrib/tlsauth/auth_test.go b/contrib/tlsauth/auth_test.go
index 8361fc3..41292b4 100644
--- a/contrib/tlsauth/auth_test.go
+++ b/contrib/tlsauth/auth_test.go
@@ -137,6 +137,7 @@ func setup(
server, err := gemini.NewServer(
context.Background(),
+ nil,
serverTLS,
"tcp",
"127.0.0.1:0",