Skip to content

Commit abd7497

Browse files
lizj3624spacewander
authored andcommitted
bugfix: the latest version of OpenResty doesn't have __ngx_cycle anymore.
1 parent 9682b6c commit abd7497

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

lualib/ngx/ssl/session/ticket.lua

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ local base = require "resty.core.base"
1010
local ffi_cast = ffi.cast
1111
local table_new = require "table.new"
1212
local ffi_str = ffi.string
13-
local cycle = getfenv(0).__ngx_cycle
1413

1514

1615
local get_string_buf = base.get_string_buf
@@ -21,8 +20,8 @@ local ptr_size = ffi.sizeof(void_ptr_type)
2120

2221

2322
ffi.cdef[[
24-
int ngx_http_lua_ffi_get_ssl_ctx_count(void *cycle);
25-
int ngx_http_lua_ffi_get_ssl_ctx_list(void *cycle, void **buf);
23+
int ngx_http_lua_ffi_get_ssl_ctx_count(void);
24+
int ngx_http_lua_ffi_get_ssl_ctx_list(void **buf);
2625
int ngx_http_lua_ffi_update_ticket_encryption_key(void *ctx,
2726
const unsigned char *key, unsigned int nkeys, char **err);
2827
int ngx_http_lua_ffi_update_last_ticket_decryption_key(void *ctx,
@@ -31,11 +30,11 @@ int ngx_http_lua_ffi_update_last_ticket_decryption_key(void *ctx,
3130

3231

3332
local function get_ssl_ctx_list()
34-
local n = C.ngx_http_lua_ffi_get_ssl_ctx_count(cycle)
33+
local n = C.ngx_http_lua_ffi_get_ssl_ctx_count()
3534
local sz = ptr_size * n
3635
local raw_buf = get_string_buf(sz)
3736
local buf = ffi_cast(void_ptr_ptr_type, raw_buf)
38-
local rc = C.ngx_http_lua_ffi_get_ssl_ctx_list(cycle, buf)
37+
local rc = C.ngx_http_lua_ffi_get_ssl_ctx_list(buf)
3938
if rc == 0 then -- NGX_OK
4039
local ret = table_new(n, 0)
4140
for i = 1, n do

src/ngx_http_lua_ssl_module.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ ngx_http_lua_ssl_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
142142

143143

144144
int
145-
ngx_http_lua_ffi_get_ssl_ctx_count(ngx_cycle_t *cycle)
145+
ngx_http_lua_ffi_get_ssl_ctx_count(void)
146146
{
147147
ngx_http_lua_ssl_main_conf_t *lmcf;
148148

149-
lmcf = ngx_http_cycle_get_module_main_conf(cycle,
149+
lmcf = ngx_http_cycle_get_module_main_conf(ngx_cycle,
150150
ngx_http_lua_ssl_module);
151151
if (lmcf == NULL) {
152152
return 0;
@@ -157,13 +157,13 @@ ngx_http_lua_ffi_get_ssl_ctx_count(ngx_cycle_t *cycle)
157157

158158

159159
int
160-
ngx_http_lua_ffi_get_ssl_ctx_list(ngx_cycle_t *cycle, SSL_CTX **buf)
160+
ngx_http_lua_ffi_get_ssl_ctx_list(SSL_CTX **buf)
161161
{
162162
SSL_CTX **pctx;
163163
ngx_uint_t i;
164164
ngx_http_lua_ssl_main_conf_t *lmcf;
165165

166-
lmcf = ngx_http_cycle_get_module_main_conf(cycle,
166+
lmcf = ngx_http_cycle_get_module_main_conf(ngx_cycle,
167167
ngx_http_lua_ssl_module);
168168

169169
if (lmcf == NULL) {

0 commit comments

Comments
 (0)