Skip to content

Commit 5a8c479

Browse files
bugfix: failed to load socket.lua when building without ssl.
1 parent 107026d commit 5a8c479

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

lib/resty/core/socket.lua

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,15 @@ ngx_http_lua_ffi_socket_tcp_get_ssl_ctx(ngx_http_request_t *r,
9090
ngx_lua_ffi_socket_tcp_getoption = C.ngx_http_lua_ffi_socket_tcp_getoption
9191
ngx_lua_ffi_socket_tcp_setoption = C.ngx_http_lua_ffi_socket_tcp_setoption
9292
ngx_lua_ffi_socket_getfd = C.ngx_http_lua_ffi_socket_tcp_getfd
93+
if pcall(function() return C.ngx_http_lua_ffi_socket_tcp_get_ssl_pointer end)
94+
then
9395
ngx_lua_ffi_socket_getsslpointer = C.ngx_http_lua_ffi_socket_tcp_get_ssl_pointer
96+
end
97+
98+
if pcall(function() return C.ngx_http_lua_ffi_socket_tcp_get_ssl_ctx end) then
9499
ngx_lua_ffi_socket_getsslctx = C.ngx_http_lua_ffi_socket_tcp_get_ssl_ctx
100+
end
101+
95102

96103
elseif subsystem == 'stream' then
97104

@@ -122,9 +129,15 @@ ngx_stream_lua_ffi_socket_tcp_get_ssl_ctx(ngx_stream_lua_request_t *r,
122129
ngx_lua_ffi_socket_tcp_getoption = C.ngx_stream_lua_ffi_socket_tcp_getoption
123130
ngx_lua_ffi_socket_tcp_setoption = C.ngx_stream_lua_ffi_socket_tcp_setoption
124131
ngx_lua_ffi_socket_getfd = C.ngx_stream_lua_ffi_socket_tcp_getfd
132+
if pcall(function() return C.ngx_stream_lua_ffi_socket_tcp_get_ssl_pointer end)
133+
then
125134
ngx_lua_ffi_socket_getsslpointer =
126135
C.ngx_stream_lua_ffi_socket_tcp_get_ssl_pointer
127-
ngx_lua_ffi_socket_getsslctx = C.ngx_stream_lua_ffi_socket_tcp_get_ssl_ctx
136+
end
137+
if pcall(function() return C.ngx_stream_lua_ffi_socket_tcp_get_ssl_pointer end)
138+
then
139+
ngx_lua_ffi_socket_getsslctx = C.ngx_stream_lua_ffi_socket_tcp_get_ssl_pointer
140+
end
128141
end
129142

130143

0 commit comments

Comments
 (0)