support fastcgi. based on diff from timkuijsten
Ted Unangst tedu@tedunangst.com
Sun, 24 Sep 2023 22:36:13 -0400
4 files changed,
17 insertions(+),
0 deletions(-)
M
docs/changelog.txt
→
docs/changelog.txt
@@ -2,6 +2,8 @@ changelog
### next ++ FastCGI listening. + + Finally fix slow public queries. ### 1.1.1 Required Refinement
M
docs/honk.8
→
docs/honk.8
@@ -38,6 +38,8 @@ Make sure to pass the Host header, if necessary (as for nginx).
.Bd -literal -offset indent proxy_set_header Host $http_host; .Ed +.Pp +FastCGI can be used by prefixing the listen address with "fcgi:". .Ss Build Building .Nm
M
web.go
→
web.go
@@ -25,6 +25,7 @@ "io"
notrand "math/rand" "mime/multipart" "net/http" + "net/http/fcgi" "net/url" "os" "os/signal"@@ -2754,6 +2755,8 @@
return fmt.Sprintf("?v=%.8x", hasher.Sum(nil)) } +var usefcgi bool + func serve() { db := opendatabase() login.Init(login.InitArgs{Db: db, Logger: ilog, Insecure: develMode, SameSiteStrict: !develMode})@@ -2892,6 +2895,12 @@ loggedin.HandleFunc("/q", showsearch)
loggedin.HandleFunc("/hydra", webhydra) loggedin.HandleFunc("/emus", showemus) loggedin.Handle("/submithonker", login.CSRFWrap("submithonker", http.HandlerFunc(websubmithonker))) + + if usefcgi { + err = fcgi.Serve(listener, mux) + } else { + err = http.Serve(listener, mux) + } err = http.Serve(listener, mux) if err != nil {