Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
9fd7acf6
authored
2015-05-15 15:04:08 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix #1152
1 parent
2dca48f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
session/session.go
session/session.go
View file @
9fd7acf
...
...
@@ -147,7 +147,7 @@ func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (se
Value
:
url
.
QueryEscape
(
sid
),
Path
:
"/"
,
HttpOnly
:
true
,
Secure
:
manager
.
config
.
Secure
,
Secure
:
manager
.
isSecure
(
r
)
,
Domain
:
manager
.
config
.
Domain
}
if
manager
.
config
.
CookieLifeTime
>
0
{
cookie
.
MaxAge
=
manager
.
config
.
CookieLifeTime
...
...
@@ -174,7 +174,7 @@ func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (se
Value
:
url
.
QueryEscape
(
sid
),
Path
:
"/"
,
HttpOnly
:
true
,
Secure
:
manager
.
config
.
Secure
,
Secure
:
manager
.
isSecure
(
r
)
,
Domain
:
manager
.
config
.
Domain
}
if
manager
.
config
.
CookieLifeTime
>
0
{
cookie
.
MaxAge
=
manager
.
config
.
CookieLifeTime
...
...
@@ -233,7 +233,7 @@ func (manager *Manager) SessionRegenerateId(w http.ResponseWriter, r *http.Reque
Value
:
url
.
QueryEscape
(
sid
),
Path
:
"/"
,
HttpOnly
:
true
,
Secure
:
manager
.
config
.
Secure
,
Secure
:
manager
.
isSecure
(
r
)
,
Domain
:
manager
.
config
.
Domain
,
}
}
else
{
...
...
@@ -270,3 +270,17 @@ func (manager *Manager) sessionId(r *http.Request) (string, error) {
}
return
hex
.
EncodeToString
(
b
),
nil
}
// Set cookie with https.
func
(
manager
*
Manager
)
isSecure
(
req
*
http
.
Request
)
bool
{
if
!
manager
.
config
.
Secure
{
return
false
}
if
req
.
URL
.
Scheme
!=
""
{
return
req
.
URL
.
Scheme
==
"https"
}
if
req
.
TLS
==
nil
{
return
false
}
return
true
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment