Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
b8e7a46f
Commit
b8e7a46f
authored
Jan 10, 2013
by
深蓝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add fcgi support
parent
10e7dc85
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
beego.go
beego.go
+19
-1
No files found.
beego.go
View file @
b8e7a46f
...
...
@@ -5,7 +5,9 @@ import (
"github.com/astaxie/session"
_
"github.com/astaxie/session/providers/memory"
"html/template"
"net"
"net/http"
"net/http/fcgi"
"os"
"path"
"strconv"
...
...
@@ -30,6 +32,7 @@ var (
SessionProvider
string
// default session provider memory
SessionName
string
// sessionName cookie's name
SessionGCMaxLifetime
int64
// session's gc maxlifetime
UseFcgi
bool
GlobalSessions
*
session
.
Manager
//GlobalSessions
)
...
...
@@ -55,6 +58,7 @@ func init() {
SessionProvider
=
"memory"
SessionName
=
"beegosessionID"
SessionGCMaxLifetime
=
3600
UseFcgi
=
false
}
else
{
HttpAddr
=
AppConfig
.
String
(
"httpaddr"
)
if
v
,
err
:=
AppConfig
.
Int
(
"httpport"
);
err
!=
nil
{
...
...
@@ -109,6 +113,11 @@ func init() {
}
else
{
SessionGCMaxLifetime
=
3600
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"usefcgi"
);
err
!=
nil
{
UseFcgi
=
false
}
else
{
UseFcgi
=
ar
}
}
StaticDir
[
"/static"
]
=
"static"
...
...
@@ -127,7 +136,16 @@ func NewApp() *App {
func
(
app
*
App
)
Run
()
{
addr
:=
fmt
.
Sprintf
(
"%s:%d"
,
HttpAddr
,
HttpPort
)
err
:=
http
.
ListenAndServe
(
addr
,
app
.
Handlers
)
var
err
error
if
UseFcgi
{
l
,
e
:=
net
.
Listen
(
"tcp"
,
addr
)
if
e
!=
nil
{
BeeLogger
.
Fatal
(
"Listen: "
,
e
)
}
err
=
fcgi
.
Serve
(
l
,
app
.
Handlers
)
}
else
{
err
=
http
.
ListenAndServe
(
addr
,
app
.
Handlers
)
}
if
err
!=
nil
{
BeeLogger
.
Fatal
(
"ListenAndServe: "
,
err
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment