Skip to content

Commit 6ef441c

Browse files
committed
Release 1.5.
1 parent 2e703f7 commit 6ef441c

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

CHANGES

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

2+
Changes with lua-resty-session 1.5 27 Nov 2014
3+
4+
*) Bugfix: Cookies are not always "secure":
5+
https://github.com/bungle/lua-resty-session/issues/5
6+
7+
Thanks @vladimir-smirnov-sociomantic
8+
9+
*) Documentation: Added documentation about Nginx SSL/TLS configuration
10+
settings related to session lifetime and ssl session ids.
11+
212
Changes with lua-resty-session 1.4 26 Nov 2014
313

414
*) Bugfix: Fixed an issue where session configurations did get cached

lib/resty/session.lua

+6-11
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ local defaults = {
156156
defaults.secret = ngx_var.session_secret or random(defaults.cipher.size / 8)
157157

158158
local session = {
159-
_VERSION = "1.4"
159+
_VERSION = "1.5"
160160
}
161161
session.__index = session
162162

@@ -199,22 +199,17 @@ end
199199

200200
function session.start(opts)
201201
local self = session.new(opts)
202-
local ssi = ngx_var.ssl_session_id
203202
if self.cookie.secure == nil then
204-
if ssi then
205-
self.cookie.secure = true
206-
else
207-
self.cookie.secure = false
208-
end
203+
self.cookie.secure = ngx_var.https == "on"
209204
end
210205
if self.cookie.domain == nil then
211206
self.cookie.domain = ngx_var.host
212207
end
213208
self.key = concat{
214-
self.check.ssi and ssi or "",
215-
self.check.ua and ngx_var.http_user_agent or "",
216-
self.check.addr and ngx_var.remote_addr or "",
217-
self.check.scheme and ngx_var.scheme or ""
209+
self.check.ssi and (ngx_var.ssl_session_id or "") or "",
210+
self.check.ua and (ngx_var.http_user_agent or "") or "",
211+
self.check.addr and (ngx_var.remote_addr or "") or "",
212+
self.check.scheme and (ngx_var.scheme or "") or ""
218213
}
219214
local now, i, e, d, h = time(), getcookie(ngx.var["cookie_" .. self.name])
220215
if i and e and e > now then

0 commit comments

Comments
 (0)