nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
metrics: allow Metric sorting
[nit.git]
/
lib
/
nitcorn
/
sessions.nit
diff --git
a/lib/nitcorn/sessions.nit
b/lib/nitcorn/sessions.nit
index
31bae5d
..
8ae26ac
100644
(file)
--- a/
lib/nitcorn/sessions.nit
+++ b/
lib/nitcorn/sessions.nit
@@
-31,7
+31,7
@@
import http_response
class Session
# Hashed id used both client and server side to identify this `Session`
class Session
# Hashed id used both client and server side to identify this `Session`
- var id_hash: String
+ var id_hash: String is noinit
init
do
init
do
@@
-80,7
+80,10
@@
redef class HttpResponse
var session = self.session
if session != null then
var session = self.session
if session != null then
- header["Set-Cookie"] = "session={session.id_hash}; HttpOnly"
+ header["Set-Cookie"] = "nitcorn_session={session.id_hash}; HttpOnly"
+ else
+ # Make sure there are no cookie left client side
+ header["Set-Cookie"] = "nitcorn_session=; HttpOnly; expires=Thu, 01 Jan 1970 00:00:00 GMT"
end
end
end
end
end
end
@@
-95,8
+98,8
@@
redef class HttpRequestParser
do
var request = super
if request != null then
do
var request = super
if request != null then
- if request.cookie.keys.has("session") then
- var id_hash = request.cookie["session"]
+ if request.cookie.keys.has("nitcorn_session") then
+ var id_hash = request.cookie["nitcorn_session"]
if sys.sessions.keys.has(id_hash) then
# Restore the session
if sys.sessions.keys.has(id_hash) then
# Restore the session