812950b6 by Jens Bissinger

Allow to use fastcgi via standard io.

1 parent a760e46f
...@@ -55,15 +55,24 @@ func (app *App) Run() { ...@@ -55,15 +55,24 @@ func (app *App) Run() {
55 endRunning := make(chan bool, 1) 55 endRunning := make(chan bool, 1)
56 56
57 if UseFcgi { 57 if UseFcgi {
58 if HttpPort == 0 { 58 if UseStdIo {
59 l, err = net.Listen("unix", addr) 59 err = fcgi.Serve(nil, app.Handlers) // standard I/O
60 if err == nil {
61 BeeLogger.Info("Use FCGI via standard I/O")
62 } else {
63 BeeLogger.Info("Cannot use FCGI via standard I/O", err)
64 }
60 } else { 65 } else {
61 l, err = net.Listen("tcp", addr) 66 if HttpPort == 0 {
67 l, err = net.Listen("unix", addr)
68 } else {
69 l, err = net.Listen("tcp", addr)
70 }
71 if err != nil {
72 BeeLogger.Critical("Listen: ", err)
73 }
74 err = fcgi.Serve(l, app.Handlers)
62 } 75 }
63 if err != nil {
64 BeeLogger.Critical("Listen: ", err)
65 }
66 err = fcgi.Serve(l, app.Handlers)
67 } else { 76 } else {
68 app.Server.Addr = addr 77 app.Server.Addr = addr
69 app.Server.Handler = app.Handlers 78 app.Server.Handler = app.Handlers
......
...@@ -61,6 +61,7 @@ var ( ...@@ -61,6 +61,7 @@ var (
61 SessionAutoSetCookie bool // auto setcookie 61 SessionAutoSetCookie bool // auto setcookie
62 SessionDomain string // the cookie domain default is empty 62 SessionDomain string // the cookie domain default is empty
63 UseFcgi bool 63 UseFcgi bool
64 UseStdIo bool
64 MaxMemory int64 65 MaxMemory int64
65 EnableGzip bool // flag of enable gzip 66 EnableGzip bool // flag of enable gzip
66 DirectoryIndex bool // flag of display directory index. default is false. 67 DirectoryIndex bool // flag of display directory index. default is false.
...@@ -241,6 +242,7 @@ func init() { ...@@ -241,6 +242,7 @@ func init() {
241 SessionAutoSetCookie = true 242 SessionAutoSetCookie = true
242 243
243 UseFcgi = false 244 UseFcgi = false
245 UseStdIo = false
244 246
245 MaxMemory = 1 << 26 //64MB 247 MaxMemory = 1 << 26 //64MB
246 248
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!