Repository navigation
fix(ssl): prefer lua-resty-core SSL accessors - #243
Open
zhuizhuhaomeng wants to merge 2 commits into
Open
zhuizhuhaomeng wants to merge 2 commits into
zhuizhuhaomeng wants to merge 2 commits into
Conversation
Use ngx.ssl.get_req_ssl_pointer and the cosocket getsslpointer and getsslctx methods when supported by the running Nginx binary. Load the existing auxiliary and FFI implementations only when needed, preserving Nginx session_ctx semantics for downstream SSL_CTX access. Correct the auxiliary SSL_CTX getter mapping and install the legacy module through the rockspec. Cover native selection, pointer casts, errors, partial availability, and HTTP/stream compatibility. Validation: 164 SSL assertions pass on Nginx 1.27.1, including with the C/Kong fallbacks disabled. Real HTTP and stream TLS probes and luacheck also pass.
Use ngx.ssl.get_req_ssl_ctx when available, preserving the borrowed SSL_CTX pointer type and propagating native errors without invoking a legacy getter. Keep the existing fallback when the Lua API is absent. Update the API-selection documentation and cover native request context selection, error propagation, stream use, and absent-API fallback. Validation: all 176 SSL assertions pass with the modified core and C exports, and with the older Nginx/core installation. Real HTTP and stream TLS probes pass with legacy initialization forbidden. Luacheck and git diff --check pass.
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.
Prefer lua-resty-core APIs for downstream SSL/SSL_CTX pointers and cosocket SSL/SSL_CTX pointers in both HTTP and stream. Native operations work without initializing the auxiliary module or version-sensitive FFI structure layouts.
Use
ngx.ssl.get_req_ssl_pointer(),ngx.ssl.get_req_ssl_ctx(),tcpsock:getsslpointer(), andtcpsock:getsslctx()when available. Cast returned pointers to the expected OpenSSL types and propagate native errors. Load the existing compatibility implementation lazily only when an API is unavailable. Also correct the auxiliary fallback's SSL_CTX getter mapping and include the legacy module in the rockspec.The request SSL_CTX Lua API is added in lua-resty-core #548, backed by lua-nginx-module #2546 and stream-lua-nginx-module #420. It preserves Nginx
session_ctxsemantics after SNI selection. This consumer change retains its fallback on older core versions and binaries.Validation:
git diff --checkpass.