Repository navigation
Conversation
sriemer
force-pushed
the
fix-lua-resty-openssl-depend
branch
from
November 17, 2026 10:32
a529d55 to
5da8d1a
Compare
Contributor
Author
|
Built and tested with the help of Requesting reviews by @catbro666, @tzssangglass, @chronolaw, @pintsized, @Tieske, @piotrp. TIA AFAICS, only @catbro666 was requesting the hard |
lua-resty-openssl is only needed for mTLS (client certificate) connections. Everything else works without it, but a warning was logged at module load time whenever it was missing. This made every worker log a `[warn]` line for users who do not use mTLS. Only log the warning when mTLS is requested and the module is not available. The error return for that case is unchanged. Also fix the README: lua-resty-openssl is not a prerequisite for all HTTP connections. Drop it from the install command and document that it is only required for mTLS.
sriemer
force-pushed
the
fix-lua-resty-openssl-depend
branch
from
November 17, 2026 11:21
5da8d1a to
1ae158e
Compare
Contributor
Author
|
Rebased for OpenResty 1.31.8.1 testing in CI. |
When mTLS is requested and lua-resty-openssl is not available, the warning including the traceback of the failed require was logged on every connect() call. The traceback lists all searched package paths, so a misconfigured deployment could flood the error log. Log the warning only once per worker. The error return is unchanged, so every mTLS attempt still fails with the same error. Add tests that verify the warning is logged exactly once when mTLS is requested without lua-resty-openssl and not at all without mTLS.
Contributor
Author
|
Added a second commit to fix the log spam issue and updated the PR description accordingly with the help of IBM Bob.
Another Bob Shell PR review is happy now with the latest code. |
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.
Summary
lua-resty-opensslis only needed for mTLS (client certificate) connections, but since #307 (310e78dd829c) a[warn]line was logged at module load time whenever it was missing. Every worker logged it, even for users who never use mTLS. The README also claimed the package is "a prerequisite for all HTTP connections", which is wrong.Changes
lib/resty/http_connect.lua: do not log at module load time. Log the warning only when mTLS is requested (ssl_client_certandssl_client_priv_keyset) andresty.openssl.*is not available, and only once per worker (module-levelopenssl_warnedflag), so a misconfigured deployment cannot flood the error log. The traceback of the failedrequirelists all searched package paths and can be several KB. The error return for that case is unchanged, so every mTLS attempt still fails with the same error. The load-timeresvariable is renamed toopenssl_err, since it is now used further from where it is defined.README.md: droplua-resty-opensslfrom the install command and document that it is optional and only required for mTLS. The warning is documented as logged once per worker.t/20-mtls.t: add two tests that simulate a missinglua-resty-openssl(failingrequireplus reload ofresty.http_connect). TEST 5 requests mTLS three times and expects the error each time but exactly one warning. TEST 6 does a non-mTLS connect and expects no[warn]and no[error].The rockspec intentionally does not list
lua-resty-openssl, because LuaRocks has no optional dependencies.Validation
Using the Docker setup from
DOCKER_BUILD.md:luacheck lib && make coverageluacheck lib && make test(after the once-per-worker fix)openssl_warnedguard disabledresty.openssl(rock removed and the copy bundled with OpenResty hidden)t/20-mtls.tTEST 3 and TEST 4, which send a real client cert and cannot work without the moduleBefore this change, nearly every test file failed in the "without
resty.openssl" setup because of the load-time[warn], which the tests assert against (no_error_log [warn]).Follow-up to #353 (
lua-resty-stringdependency).