Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/resty/openssl/auxiliary/nginx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ else
local ngx_configure = ngx.config.nginx_configure()
local ngx_has_http_v3 = ngx_configure and ngx_configure:find("--with-http_v3_module", 1, true)
-- https://github.com/nginx/nginx/blob/master/src/core/ngx_connection.h
if ngx_version == 1017008 or ngx_version == 1019003 or ngx_version == 1019009
if ngx_version == 1017008 or ngx_version == 1019003 or ngx_version == 1019009
or ngx_version == 1021004
or (not ngx_has_http_v3 and (ngx_version == 1025003 or ngx_version == 1027001)) then
-- 1.17.8, 1.19.3, 1.19.9, 1.21.4, 1.25.3
or (not ngx_has_http_v3 and (ngx_version == 1025003 or ngx_version == 1027001 or ngx_version == 1029002)) then
-- 1.17.8, 1.19.3, 1.19.9, 1.21.4, 1.25.3, 1.27.1, 1.29.2
ffi.cdef [[
typedef struct ngx_proxy_protocol_s ngx_proxy_protocol_t;

Expand Down Expand Up @@ -83,8 +83,8 @@ else
// trimmed
} ngx_connection_s;
]]
elseif ngx_has_http_v3 and (ngx_version == 1025003 or ngx_version == 1027001) then
-- 1.25.3
elseif ngx_has_http_v3 and (ngx_version == 1025003 or ngx_version == 1027001 or ngx_version == 1029002) then
-- 1.25.3, 1.27.1, 1.29.2
ffi.cdef [[
typedef struct ngx_proxy_protocol_s ngx_proxy_protocol_t;
typedef struct ngx_quic_stream_s ngx_quic_stream_t;
Expand Down Expand Up @@ -256,7 +256,7 @@ else
ngx.config.ngx_lua_version and
ngx.config.ngx_lua_version

if ngx_lua_version >= 10019 and ngx_lua_version <= 10028 then
if ngx_lua_version >= 10019 and ngx_lua_version <= 10030 then
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If ngx_lua_version is nil (which can happen if ngx.config.ngx_lua_version is missing), this comparison will throw a runtime error: attempt to compare number with nil. Although this is existing logic, since you are modifying this line, it's a good opportunity to add a safety check to ensure ngx_lua_version is truthy before performing the comparison. This ensures the code gracefully falls through to the else block which handles the nil case with a descriptive error message.

  if ngx_lua_version and ngx_lua_version >= 10019 and ngx_lua_version <= 10030 then

-- https://github.com/openresty/lua-nginx-module/blob/master/src/ngx_http_lua_socket_tcp.h
ffi.cdef[[
typedef struct {
Expand Down