Skip to content

Commit 78aff58

Browse files
authored
bugfix: sslhandshake lost verify error when handshake completed immediately (#2506)
After ngx_ssl_handshake(c) returns NGX_OK, the handshake handler may still record a verify error in u->error_ret via SSL_get_verify_result(). The old code only checked rc == NGX_ERROR and missed u->error_ret, returning FFI_OK with an unread error. Added u->error_ret != NULL check so the Lua caller receives the SSL error instead of a misleading "closed" on the next socket operation.
1 parent 4b21d8f commit 78aff58

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/ngx_http_lua_socket_tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2035,7 +2035,7 @@ ngx_http_lua_ffi_socket_tcp_sslhandshake(ngx_http_request_t *r,
20352035

20362036
ngx_http_lua_ssl_handshake_handler(c);
20372037

2038-
if (rc == NGX_ERROR) {
2038+
if (rc == NGX_ERROR || u->error_ret != NULL) {
20392039
*errmsg = u->error_ret;
20402040
return NGX_ERROR;
20412041
}

0 commit comments

Comments
 (0)