Skip to content

Commit d62acdc

Browse files
committed
bugfix: sslhandshake read error details on immediate FFI_ERROR
With the C side now returning FFI_ERROR instead of FFI_OK when u->error_ret is set after an immediate handshake, the early FFI_OK path is removed. Added get_sslhandshake_result() in the FFI_ERROR branch so errmsg and openssl_error_code are populated when the error comes from the first call rather than from an async resume.
1 parent e68e857 commit d62acdc

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

lib/resty/core/socket.lua

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -424,17 +424,11 @@ local function sslhandshake(cosocket, reused_session, server_name, ssl_verify,
424424
error("no request ctx found", 2)
425425
end
426426

427-
if rc == FFI_OK then
428-
if reused_session == false then
429-
return true
430-
end
431-
432-
rc = C.ngx_http_lua_ffi_socket_tcp_get_sslhandshake_result(r, u,
433-
session_ptr, errmsg, openssl_error_code)
434-
end
435-
436427
while true do
437428
if rc == FFI_ERROR then
429+
rc = C.ngx_http_lua_ffi_socket_tcp_get_sslhandshake_result(r, u,
430+
session_ptr, errmsg, openssl_error_code)
431+
438432
if openssl_error_code[0] ~= 0 then
439433
return nil, openssl_error_code[0] .. ": " .. ffi_str(errmsg[0])
440434
end

0 commit comments

Comments
 (0)