bugfix: remove sslhandshake result assert for pre-handshake errors.#534
Merged
zhuizhuhaomeng merged 1 commit intoJun 6, 2026
Merged
Conversation
Contributor
Author
|
As a fix for #533 |
Contributor
Author
|
ping @zhuizhuhaomeng |
e330467 to
9a07206
Compare
When `tcpsock:sslhandshake()` fails before the actual SSL handshake starts, `ngx_http_lua_ffi_socket_tcp_get_sslhandshake_result()` may return `FFI_OK` while still providing the OpenSSL error details. One example is a client private key setup failure. In that path, `rc` is `FFI_ERROR`, but `u->error_ret` is not set, so `ngx_http_lua_ffi_socket_tcp_get_sslhandshake_result` would return `FFI_OK`. The existing `assert(res == FFI_ERROR)` turns this expected error-reporting path into an assertion failure. This patch removes the assertion so Lua can return the original SSL error to the caller.
9a07206 to
e3d5506
Compare
zhuizhuhaomeng
approved these changes
Jun 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
tcpsock:sslhandshake()fails before the actual SSL handshake starts,ngx_http_lua_ffi_socket_tcp_get_sslhandshake_result()may returnFFI_OKwhile still providing the OpenSSL error details.One example is a client private key setup failure. In that path,
rcisFFI_ERROR, butu->error_retis not set, songx_http_lua_ffi_socket_tcp_get_sslhandshake_resultwould returnFFI_OK. The existingassert(res == FFI_ERROR)turns this expected error-reporting path into an assertion failure.This patch removes the assertion so Lua can return the original SSL error to the caller.
I hereby granted the copyright of the changes in this pull request
to the authors of this lua-resty-core project.