Skip to content

The sslhandshake function does not handle the scenario where ngx_http_lua_ffi_socket_tcp_sslhandshake directly returns FFI_OK. #499

@akf00000

Description

@akf00000

When i test the sslhandshake future,i connect to local machine and i set the ssl_verify future, sometimes it failed in assert check.

log:
/usr/local/openresty/lualib/resty/core/socket.lua:281: assertion failed!

I add some log and found the ngx_http_lua_ffi_socket_tcp_sslhandshake return FFI_OK, when assert failed happen。

I think it should add check FFI_OK:

local rc = C.ngx_http_lua_ffi_socket_tcp_sslhandshake(r, u,
               session_ptr[0],
               reused_session ~= false,
               server_name_str,
               ssl_verify and 1 or 0,
               send_status_req and 1 or 0,
               cosocket[SOCKET_CLIENT_CERT_INDEX],
               cosocket[SOCKET_CLIENT_PKEY_INDEX],
               errmsg)

if rc == FFI_NO_REQ_CTX then
    error("no request ctx found", 2)
end

if rc == FFI_OK then
    if reused_session == false then
        return true
    end

    rc = C.ngx_http_lua_ffi_socket_tcp_get_sslhandshake_result(r, u,
             session_ptr, errmsg, openssl_error_code)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions