Skip to content

Commit fb0337e

Browse files
committed
Modified Changes and small mods to session.lua as well. This marks the release 1.1.
1 parent b51f051 commit fb0337e

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

CHANGES

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11

2+
Changes with lua-resty-session 1.1 3 Oct 2014
3+
4+
*) Security: There was a bug where additional user agent, scheme, and
5+
remote addr (disabled by default) was not checked.
6+
7+
*) Feature: Added _VERSION field.
8+
9+
*) Change: Simplied a code a lot (e.g. internal setcookie and getcookie
10+
functions are now cleaner). Removed a lot of unneccessary lines from
11+
session.start by adding configs directly to session prototype.
12+
213
Changes with lua-resty-session 1.0 24 Sep 2014
314

415
*) Feature: LuaRocks Support via MoonRocks.

lib/resty/session.lua

+6-6
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,17 @@ function setcookie(session, value, expires)
115115
return true
116116
end
117117

118-
local function getcookie(c)
119-
if c == nil then return end
118+
local function getcookie(cookie)
119+
if not cookie then return end
120120
local r = {}
121-
local i, p, s, e = 1, 1, c:find("|", 1, true)
121+
local i, p, s, e = 1, 1, cookie:find("|", 1, true)
122122
while s do
123123
if i > 3 then return end
124-
r[i] = c:sub(p, e - 1)
124+
r[i] = cookie:sub(p, e - 1)
125125
i, p = i + 1, e + 1
126-
s, e = c:find("|", p, true)
126+
s, e = cookie:find("|", p, true)
127127
end
128-
r[4] = c:sub(p)
128+
r[4] = cookie:sub(p)
129129
return decode(r[1]), tonumber(r[2]), decode(r[3]), decode(r[4])
130130
end
131131

0 commit comments

Comments
 (0)