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
769735c2
Commit
769735c2
authored
Aug 20, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #166
parent
b114f258
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
context.go
context.go
+15
-5
flash.go
flash.go
+3
-3
No files found.
context.go
View file @
769735c2
...
...
@@ -74,14 +74,24 @@ func (ctx *Context) SetCookie(name string, value string, others ...interface{})
if
len
(
others
)
>
0
{
switch
others
[
0
]
.
(
type
)
{
case
int
:
fmt
.
Fprintf
(
&
b
,
"; Max-Age=%d"
,
others
[
0
]
.
(
int
))
if
others
[
0
]
.
(
int
)
>
0
{
fmt
.
Fprintf
(
&
b
,
"; Max-Age=%d"
,
others
[
0
]
.
(
int
))
}
else
if
others
[
0
]
.
(
int
)
<
0
{
fmt
.
Fprintf
(
&
b
,
"; Max-Age=0"
)
}
case
int64
:
fmt
.
Fprintf
(
&
b
,
"; Max-Age=%d"
,
others
[
0
]
.
(
int64
))
if
others
[
0
]
.
(
int64
)
>
0
{
fmt
.
Fprintf
(
&
b
,
"; Max-Age=%d"
,
others
[
0
]
.
(
int64
))
}
else
if
others
[
0
]
.
(
int64
)
<
0
{
fmt
.
Fprintf
(
&
b
,
"; Max-Age=0"
)
}
case
int32
:
fmt
.
Fprintf
(
&
b
,
"; Max-Age=%d"
,
others
[
0
]
.
(
int32
))
if
others
[
0
]
.
(
int32
)
>
0
{
fmt
.
Fprintf
(
&
b
,
"; Max-Age=%d"
,
others
[
0
]
.
(
int32
))
}
else
if
others
[
0
]
.
(
int32
)
<
0
{
fmt
.
Fprintf
(
&
b
,
"; Max-Age=0"
)
}
}
}
else
{
fmt
.
Fprintf
(
&
b
,
"; Max-Age=0"
)
}
if
len
(
others
)
>
1
{
fmt
.
Fprintf
(
&
b
,
"; Path=%s"
,
sanitizeValue
(
others
[
1
]
.
(
string
)))
...
...
flash.go
View file @
769735c2
...
...
@@ -54,7 +54,8 @@ func ReadFromRequest(c *Controller) *FlashData {
Data
:
make
(
map
[
string
]
string
),
}
if
cookie
,
err
:=
c
.
Ctx
.
Request
.
Cookie
(
"BEEGO_FLASH"
);
err
==
nil
{
vals
:=
strings
.
Split
(
cookie
.
Value
,
"
\x00
"
)
v
,
_
:=
url
.
QueryUnescape
(
cookie
.
Value
)
vals
:=
strings
.
Split
(
v
,
"
\x00
"
)
for
_
,
v
:=
range
vals
{
if
len
(
v
)
>
0
{
kv
:=
strings
.
Split
(
v
,
":"
)
...
...
@@ -64,8 +65,7 @@ func ReadFromRequest(c *Controller) *FlashData {
}
}
//read one time then delete it
cookie
.
MaxAge
=
-
1
c
.
Ctx
.
Request
.
AddCookie
(
cookie
)
c
.
Ctx
.
SetCookie
(
"BEEGO_FLASH"
,
""
,
-
1
)
}
c
.
Data
[
"flash"
]
=
flash
.
Data
return
flash
...
...
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