Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
二次元的罪恶王冠
beego
提交
18a02d7d
B
beego
项目概览
二次元的罪恶王冠
/
beego
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
beego
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
18a02d7d
编写于
5月 20, 2014
作者:
A
astaxie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
beego:support https & http listen
上级
3f4d750d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
43 addition
and
13 deletion
+43
-13
admin.go
admin.go
+1
-1
app.go
app.go
+25
-8
beego.go
beego.go
+1
-1
config.go
config.go
+16
-3
未找到文件。
admin.go
浏览文件 @
18a02d7d
...
@@ -88,7 +88,7 @@ func listConf(rw http.ResponseWriter, r *http.Request) {
...
@@ -88,7 +88,7 @@ func listConf(rw http.ResponseWriter, r *http.Request) {
fmt
.
Fprintln
(
rw
,
"StaticExtensionsToGzip:"
,
StaticExtensionsToGzip
)
fmt
.
Fprintln
(
rw
,
"StaticExtensionsToGzip:"
,
StaticExtensionsToGzip
)
fmt
.
Fprintln
(
rw
,
"HttpAddr:"
,
HttpAddr
)
fmt
.
Fprintln
(
rw
,
"HttpAddr:"
,
HttpAddr
)
fmt
.
Fprintln
(
rw
,
"HttpPort:"
,
HttpPort
)
fmt
.
Fprintln
(
rw
,
"HttpPort:"
,
HttpPort
)
fmt
.
Fprintln
(
rw
,
"HttpTLS:"
,
HttpTLS
)
fmt
.
Fprintln
(
rw
,
"HttpTLS:"
,
Enable
HttpTLS
)
fmt
.
Fprintln
(
rw
,
"HttpCertFile:"
,
HttpCertFile
)
fmt
.
Fprintln
(
rw
,
"HttpCertFile:"
,
HttpCertFile
)
fmt
.
Fprintln
(
rw
,
"HttpKeyFile:"
,
HttpKeyFile
)
fmt
.
Fprintln
(
rw
,
"HttpKeyFile:"
,
HttpKeyFile
)
fmt
.
Fprintln
(
rw
,
"RecoverPanic:"
,
RecoverPanic
)
fmt
.
Fprintln
(
rw
,
"RecoverPanic:"
,
RecoverPanic
)
...
...
app.go
浏览文件 @
18a02d7d
...
@@ -45,6 +45,7 @@ func (app *App) Run() {
...
@@ -45,6 +45,7 @@ func (app *App) Run() {
err
error
err
error
l
net
.
Listener
l
net
.
Listener
)
)
endRunning
:=
make
(
chan
bool
)
if
UseFcgi
{
if
UseFcgi
{
if
HttpPort
==
0
{
if
HttpPort
==
0
{
...
@@ -83,18 +84,34 @@ func (app *App) Run() {
...
@@ -83,18 +84,34 @@ func (app *App) Run() {
ReadTimeout
:
time
.
Duration
(
HttpServerTimeOut
)
*
time
.
Second
,
ReadTimeout
:
time
.
Duration
(
HttpServerTimeOut
)
*
time
.
Second
,
WriteTimeout
:
time
.
Duration
(
HttpServerTimeOut
)
*
time
.
Second
,
WriteTimeout
:
time
.
Duration
(
HttpServerTimeOut
)
*
time
.
Second
,
}
}
if
HttpTLS
{
if
EnableHttpTLS
{
err
=
s
.
ListenAndServeTLS
(
HttpCertFile
,
HttpKeyFile
)
go
func
()
{
}
else
{
if
HttpsPort
!=
0
{
err
=
s
.
ListenAndServe
()
s
.
Addr
=
fmt
.
Sprintf
(
"%s:%d"
,
HttpAddr
,
HttpsPort
)
}
err
:=
s
.
ListenAndServeTLS
(
HttpCertFile
,
HttpKeyFile
)
if
err
!=
nil
{
BeeLogger
.
Critical
(
"ListenAndServe: "
,
err
)
time
.
Sleep
(
100
*
time
.
Microsecond
)
endRunning
<-
true
}
}()
}
if
EnableHttpListen
{
go
func
()
{
err
:=
s
.
ListenAndServe
()
if
err
!=
nil
{
BeeLogger
.
Critical
(
"ListenAndServe: "
,
err
)
time
.
Sleep
(
100
*
time
.
Microsecond
)
endRunning
<-
true
}
}()
}
}
}
}
}
}
if
err
!=
nil
{
<-
endRunning
BeeLogger
.
Critical
(
"ListenAndServe: "
,
err
)
time
.
Sleep
(
100
*
time
.
Microsecond
)
}
}
}
// Router adds a url-patterned controller handler.
// Router adds a url-patterned controller handler.
...
...
beego.go
浏览文件 @
18a02d7d
...
@@ -270,7 +270,7 @@ func initBeforeHttpRun() {
...
@@ -270,7 +270,7 @@ func initBeforeHttpRun() {
sessionConfig
=
`{"cookieName":"`
+
SessionName
+
`",`
+
sessionConfig
=
`{"cookieName":"`
+
SessionName
+
`",`
+
`"gclifetime":`
+
strconv
.
FormatInt
(
SessionGCMaxLifetime
,
10
)
+
`,`
+
`"gclifetime":`
+
strconv
.
FormatInt
(
SessionGCMaxLifetime
,
10
)
+
`,`
+
`"providerConfig":"`
+
SessionSavePath
+
`",`
+
`"providerConfig":"`
+
SessionSavePath
+
`",`
+
`"secure":`
+
strconv
.
FormatBool
(
HttpTLS
)
+
`,`
+
`"secure":`
+
strconv
.
FormatBool
(
Enable
HttpTLS
)
+
`,`
+
`"sessionIDHashFunc":"`
+
SessionHashFunc
+
`",`
+
`"sessionIDHashFunc":"`
+
SessionHashFunc
+
`",`
+
`"sessionIDHashKey":"`
+
SessionHashKey
+
`",`
+
`"sessionIDHashKey":"`
+
SessionHashKey
+
`",`
+
`"enableSetCookie":`
+
strconv
.
FormatBool
(
SessionAutoSetCookie
)
+
`,`
+
`"enableSetCookie":`
+
strconv
.
FormatBool
(
SessionAutoSetCookie
)
+
`,`
+
...
...
config.go
浏览文件 @
18a02d7d
...
@@ -30,9 +30,11 @@ var (
...
@@ -30,9 +30,11 @@ var (
StaticDir
map
[
string
]
string
StaticDir
map
[
string
]
string
TemplateCache
map
[
string
]
*
template
.
Template
// template caching map
TemplateCache
map
[
string
]
*
template
.
Template
// template caching map
StaticExtensionsToGzip
[]
string
// files with should be compressed with gzip (.js,.css,etc)
StaticExtensionsToGzip
[]
string
// files with should be compressed with gzip (.js,.css,etc)
EnableHttpListen
bool
HttpAddr
string
HttpAddr
string
HttpPort
int
HttpPort
int
HttpTLS
bool
EnableHttpTLS
bool
HttpsPort
int
HttpCertFile
string
HttpCertFile
string
HttpKeyFile
string
HttpKeyFile
string
RecoverPanic
bool
// flag of auto recover panic
RecoverPanic
bool
// flag of auto recover panic
...
@@ -98,9 +100,12 @@ func init() {
...
@@ -98,9 +100,12 @@ func init() {
TemplateCache
=
make
(
map
[
string
]
*
template
.
Template
)
TemplateCache
=
make
(
map
[
string
]
*
template
.
Template
)
// set this to 0.0.0.0 to make this app available to externally
// set this to 0.0.0.0 to make this app available to externally
EnableHttpListen
=
true
//default enable http Listen
HttpAddr
=
""
HttpAddr
=
""
HttpPort
=
8080
HttpPort
=
8080
HttpsPort
=
443
AppName
=
"beego"
AppName
=
"beego"
RunMode
=
"dev"
//default runmod
RunMode
=
"dev"
//default runmod
...
@@ -176,6 +181,10 @@ func ParseConfig() (err error) {
...
@@ -176,6 +181,10 @@ func ParseConfig() (err error) {
HttpPort
=
v
HttpPort
=
v
}
}
if
v
,
err
:=
AppConfig
.
Bool
(
"EnableHttpListen"
);
err
==
nil
{
EnableHttpListen
=
v
}
if
maxmemory
,
err
:=
AppConfig
.
Int64
(
"MaxMemory"
);
err
==
nil
{
if
maxmemory
,
err
:=
AppConfig
.
Int64
(
"MaxMemory"
);
err
==
nil
{
MaxMemory
=
maxmemory
MaxMemory
=
maxmemory
}
}
...
@@ -281,8 +290,12 @@ func ParseConfig() (err error) {
...
@@ -281,8 +290,12 @@ func ParseConfig() (err error) {
TemplateRight
=
tplright
TemplateRight
=
tplright
}
}
if
httptls
,
err
:=
AppConfig
.
Bool
(
"HttpTLS"
);
err
==
nil
{
if
httptls
,
err
:=
AppConfig
.
Bool
(
"EnableHttpTLS"
);
err
==
nil
{
HttpTLS
=
httptls
EnableHttpTLS
=
httptls
}
if
httpsport
,
err
:=
AppConfig
.
Int
(
"HttpsPort"
);
err
==
nil
{
HttpsPort
=
httpsport
}
}
if
certfile
:=
AppConfig
.
String
(
"HttpCertFile"
);
certfile
!=
""
{
if
certfile
:=
AppConfig
.
String
(
"HttpCertFile"
);
certfile
!=
""
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录