ec6383c0 by astaxie

Merge pull request #858 from bsingr/develop

Allow to use fastcgi via standard io.
2 parents 76db5cde 812950b6
...@@ -55,6 +55,14 @@ func (app *App) Run() { ...@@ -55,6 +55,14 @@ 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 UseStdIo {
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 }
65 } else {
58 if HttpPort == 0 { 66 if HttpPort == 0 {
59 l, err = net.Listen("unix", addr) 67 l, err = net.Listen("unix", addr)
60 } else { 68 } else {
...@@ -64,6 +72,7 @@ func (app *App) Run() { ...@@ -64,6 +72,7 @@ func (app *App) Run() {
64 BeeLogger.Critical("Listen: ", err) 72 BeeLogger.Critical("Listen: ", err)
65 } 73 }
66 err = fcgi.Serve(l, app.Handlers) 74 err = fcgi.Serve(l, app.Handlers)
75 }
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!