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
a7452388
Commit
a7452388
authored
Apr 28, 2016
by
astaxie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1912 from ysqi/issue02
Fixed some bug
parents
520a417c
fa741645
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
13 deletions
+14
-13
beego.go
beego.go
+4
-2
config.go
config.go
+1
-1
output.go
context/output.go
+7
-4
session.go
session/session.go
+2
-6
No files found.
beego.go
View file @
a7452388
...
...
@@ -85,9 +85,11 @@ func initBeforeHTTPRun() {
// TestBeegoInit is for test package init
func
TestBeegoInit
(
ap
string
)
{
os
.
Setenv
(
"BEEGO_RUNMODE"
,
"test"
)
appConfigPath
=
filepath
.
Join
(
ap
,
"conf"
,
"app.conf"
)
os
.
Chdir
(
ap
)
LoadAppConfig
(
appConfigProvider
,
appConfigPath
)
if
err
:=
LoadAppConfig
(
appConfigProvider
,
appConfigPath
);
err
!=
nil
{
panic
(
err
)
}
BConfig
.
RunMode
=
"test"
initBeforeHTTPRun
()
}
config.go
View file @
a7452388
...
...
@@ -274,7 +274,7 @@ func assignConfig(ac config.Configer) error {
for
adaptor
,
config
:=
range
BConfig
.
Log
.
Outputs
{
err
:=
logs
.
SetLogger
(
adaptor
,
config
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
"%s with the config `%s` got err:%s
\n
"
,
adaptor
,
config
,
err
)
fmt
.
Fprintln
(
os
.
Stderr
,
fmt
.
Sprintf
(
"%s with the config %q got err:%s"
,
adaptor
,
config
,
err
.
Error
())
)
}
}
logs
.
SetLogFuncCall
(
BConfig
.
Log
.
FileLineNum
)
...
...
context/output.go
View file @
a7452388
...
...
@@ -24,6 +24,7 @@ import (
"io"
"mime"
"net/http"
"net/url"
"os"
"path/filepath"
"strconv"
...
...
@@ -244,13 +245,15 @@ func (output *BeegoOutput) Download(file string, filename ...string) {
return
}
output
.
Header
(
"Content-Description"
,
"File Transfer"
)
output
.
Header
(
"Content-Type"
,
"application/octet-stream"
)
var
fName
string
if
len
(
filename
)
>
0
&&
filename
[
0
]
!=
""
{
output
.
Header
(
"Content-Disposition"
,
"attachment; filename="
+
filename
[
0
])
fName
=
filename
[
0
]
}
else
{
output
.
Header
(
"Content-Disposition"
,
"attachment; filename="
+
filepath
.
Base
(
file
)
)
fName
=
filepath
.
Base
(
file
)
}
output
.
Header
(
"Content-Disposition"
,
"attachment; filename="
+
url
.
QueryEscape
(
fName
))
output
.
Header
(
"Content-Description"
,
"File Transfer"
)
output
.
Header
(
"Content-Type"
,
"application/octet-stream"
)
output
.
Header
(
"Content-Transfer-Encoding"
,
"binary"
)
output
.
Header
(
"Expires"
,
"0"
)
output
.
Header
(
"Cache-Control"
,
"must-revalidate"
)
...
...
session/session.go
View file @
a7452388
...
...
@@ -132,17 +132,13 @@ func NewManager(provideName, config string) (*Manager, error) {
if
cf
.
EnableSidInHttpHeader
{
if
cf
.
SessionNameInHttpHeader
==
""
{
err
=
errors
.
New
(
"SessionNameInHttpHeader is empty"
)
panic
(
err
)
return
nil
,
err
panic
(
errors
.
New
(
"SessionNameInHttpHeader is empty"
))
}
strMimeHeader
:=
textproto
.
CanonicalMIMEHeaderKey
(
cf
.
SessionNameInHttpHeader
)
if
cf
.
SessionNameInHttpHeader
!=
strMimeHeader
{
strErrMsg
:=
"SessionNameInHttpHeader ("
+
cf
.
SessionNameInHttpHeader
+
") has the wrong format, it should be like this : "
+
strMimeHeader
err
=
errors
.
New
(
strErrMsg
)
panic
(
err
)
return
nil
,
err
panic
(
errors
.
New
(
strErrMsg
))
}
}
...
...
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