Cache Basic auth header on Realm#2267
Open
pavel-ptashyts wants to merge 2 commits into
Open
Conversation
pavel-ptashyts
force-pushed
the
perf/basic-auth-header-cache
branch
from
July 20, 2026 08:50
9466f51 to
b071fff
Compare
Cache the generated HTTP Basic authorization header on immutable Realm instances so repeated preemptive and proxy Basic auth requests can reuse the same header string. This avoids rebuilding credentials and Base64 output on every dispatch. Add a regression test that verifies repeated per-request Basic auth header generation returns the cached value. Codex on behalf of Pavel Ptashyts Co-Authored-By: Codex <codex@openai.com>
pavel-ptashyts
force-pushed
the
perf/basic-auth-header-cache
branch
from
July 20, 2026 15:08
9ea7c4f to
06d225a
Compare
Document the lazy cache semantics of Realm.getBasicAuthHeader(), including its intentional public API status and benign duplicate computation during concurrent first access. Extend the regression test to verify that request and proxy authentication reuse the same cached header instance. Codex on behalf of Pavel Ptashyts Co-Authored-By: Codex <codex@openai.com>
pavel-ptashyts
force-pushed
the
perf/basic-auth-header-cache
branch
from
July 20, 2026 15:23
06d225a to
f167215
Compare
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
RealminstancesRealm.getBasicAuthHeader()as an intentional public API introduced in 3.0.12StringinstanceAPI note
The accessor is public because
Realmand the Netty authentication utilities are in different packages. It exposes only the immutable derived header value and avoids adding mutable cache management to the public surface.Validation
./mvnw -pl client -Dtest='org.asynchttpclient.util.AuthenticatorUtilsTest,org.asynchttpclient.RealmTest' test(44 tests)Attribution
Codex on behalf of Pavel Ptashyts