diff options
author | zeripath <art27@cantab.net> | 2019-12-10 12:23:26 +0000 |
---|---|---|
committer | Antoine GIRARD <sapk@users.noreply.github.com> | 2019-12-10 13:23:26 +0100 |
commit | 2c83dac5d47195b7589a9e879598d00c00f1b302 (patch) | |
tree | 1d5007bcfbc7781521986fb7d777e53087c133c6 /cmd | |
parent | 4dc3993b221cf7b321e578e1f542891a49714b2d (diff) | |
download | gitea-2c83dac5d47195b7589a9e879598d00c00f1b302.tar.gz gitea-2c83dac5d47195b7589a9e879598d00c00f1b302.zip |
FCGI: Allow FCGI over unix sockets (#9298)
* FCGI: Allow FCGI over unix sockets
* fixup! FCGI: Allow FCGI over unix sockets
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web.go | 8 | ||||
-rw-r--r-- | cmd/web_graceful.go | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/cmd/web.go b/cmd/web.go index e0e47a181f..cc00a32198 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -122,6 +122,7 @@ func runWeb(ctx *cli.Context) error { switch setting.Protocol { case setting.UnixSocket: case setting.FCGI: + case setting.FCGIUnix: default: // Save LOCAL_ROOT_URL if port changed cfg := ini.Empty() @@ -149,7 +150,7 @@ func runWeb(ctx *cli.Context) error { } listenAddr := setting.HTTPAddr - if setting.Protocol != setting.UnixSocket { + if setting.Protocol != setting.UnixSocket && setting.Protocol != setting.FCGIUnix { listenAddr += ":" + setting.HTTPPort } log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubURL) @@ -183,10 +184,13 @@ func runWeb(ctx *cli.Context) error { err = runHTTPS("tcp", listenAddr, setting.CertFile, setting.KeyFile, context2.ClearHandler(m)) case setting.FCGI: NoHTTPRedirector() - err = runFCGI(listenAddr, context2.ClearHandler(m)) + err = runFCGI("tcp", listenAddr, context2.ClearHandler(m)) case setting.UnixSocket: NoHTTPRedirector() err = runHTTP("unix", listenAddr, context2.ClearHandler(m)) + case setting.FCGIUnix: + NoHTTPRedirector() + err = runFCGI("unix", listenAddr, context2.ClearHandler(m)) default: log.Fatal("Invalid protocol: %s", setting.Protocol) } diff --git a/cmd/web_graceful.go b/cmd/web_graceful.go index e303f71510..5f8b85b390 100644 --- a/cmd/web_graceful.go +++ b/cmd/web_graceful.go @@ -37,9 +37,9 @@ func NoMainListener() { graceful.Manager.InformCleanup() } -func runFCGI(listenAddr string, m http.Handler) error { +func runFCGI(network, listenAddr string, m http.Handler) error { // This needs to handle stdin as fcgi point - fcgiServer := graceful.NewServer("tcp", listenAddr) + fcgiServer := graceful.NewServer(network, listenAddr) err := fcgiServer.ListenAndServe(func(listener net.Listener) error { return fcgi.Serve(listener, m) |