Skip to content

Avoid duplicate preemptive Digest hashing#2276

Open
pavel-ptashyts wants to merge 1 commit into
AsyncHttpClient:mainfrom
maygemdev:perf/preemptive-digest-ha1
Open

Avoid duplicate preemptive Digest hashing#2276
pavel-ptashyts wants to merge 1 commit into
AsyncHttpClient:mainfrom
maygemdev:perf/preemptive-digest-ha1

Conversation

@pavel-ptashyts

Copy link
Copy Markdown
Contributor

Summary

  • pass the auth-int entity-body hash to the request-specific Realm.Builder
  • build the preemptive Digest realm once for origin and proxy authentication
  • remove the duplicate digest-response implementation that was recalculating HA1 and whose result was overwritten by the final build
  • verify the emitted origin and proxy responses against an independent MD5 calculation

This follows the entity-body-hash flow already used by the 401 and 407 interceptors. It does not modify Realm.java, so it remains compatible with #2269.

Verification

  • ./mvnw -pl client -Dtest=org.asynchttpclient.util.AuthenticatorUtilsTest,org.asynchttpclient.RealmTest,org.asynchttpclient.DigestAuthTest,org.asynchttpclient.DigestAuthRfc7616Test test (53 tests passed)
  • ./mvnw -B -ntp -pl client -DskipTests -Dmaven.javadoc.skip=true -Dgpg.skip=true verify (Revapi passed)

The full JDK 11 ./mvnw clean verify gate was not run because this environment provides JDK 21 only.

Codex on behalf of Pavel Ptashyts

Preemptive auth-int built temporary Realm objects and recalculated
HA1 before rebuilding the realm again. The final build also
overwrote the response that included the request body.

Pass the entity-body hash to the request-specific realm builder and
build it once for both origin and proxy authentication. Remove the
duplicate digest calculation path and verify the emitted response
independently.

Codex on behalf of Pavel Ptashyts

Co-Authored-By: Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant