@@ -156,7 +156,7 @@ local defaults = {
156
156
defaults .secret = ngx_var .session_secret or random (defaults .cipher .size / 8 )
157
157
158
158
local session = {
159
- _VERSION = " 1.4 "
159
+ _VERSION = " 1.5 "
160
160
}
161
161
session .__index = session
162
162
@@ -199,22 +199,17 @@ end
199
199
200
200
function session .start (opts )
201
201
local self = session .new (opts )
202
- local ssi = ngx_var .ssl_session_id
203
202
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"
209
204
end
210
205
if self .cookie .domain == nil then
211
206
self .cookie .domain = ngx_var .host
212
207
end
213
208
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 " "
218
213
}
219
214
local now , i , e , d , h = time (), getcookie (ngx .var [" cookie_" .. self .name ])
220
215
if i and e and e > now then
0 commit comments