Skip to content

http digest: tie peer on input - #22683

Closed
icing wants to merge 8 commits into
curl:masterfrom
icing:digest-flush-on-input
Closed

icing wants to merge 8 commits into
curl:masterfrom
icing:digest-flush-on-input

Conversation

@icing

@icing icing commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Tie the peer already on input handling and flush stale data when it changed. Leave creds NULL as digest state after "input" (parsing a server header) is unrelated to creds. The tie to credentials happens on "output", e.g. when a header is sent.

@icing icing changed the title http digest: tie peer/credentials on input http digest: tie peer on input Aug 26, 2026
icing added 4 commits August 26, 2026 13:13
Tie the peer/origin already on input handling and
flush stale data when it changed.
Fix the handling of digest reset on input to react to
peer changes, link the peer but leave creds NULL. Digest
state at input time has no relation to creds.

The dependency on creds is only set on use, e.g. when
generating output.
@icing
icing force-pushed the digest-flush-on-input branch from cd5eb3a to 9be1182 Compare August 26, 2026 11:21
@bagder
bagder requested a lite review from Copilot August 26, 2026 11:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates HTTP Digest authentication handling so Digest state is tied to the peer/origin when parsing server headers (“input”), and stale Digest state is flushed when switching to a different peer or different credentials when generating auth headers (“output”). It also adds a new libtest + testcase to cover a handle-reuse scenario where a Digest challenge is received when Digest isn’t requested, then Digest is later enabled against a different host.

Changes:

  • Add peer/origin tracking on Digest “input” and flush stale Digest state on “output”.
  • Introduce new libtest lib1985 and testcase test1985 to validate Digest state isolation across origins when reusing an easy handle.
  • Register the new libtest/testcase in the test build files.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/http_digest.c Adds stale-state flushing and origin tracking for Digest auth across input/output paths.
tests/libtest/Makefile.inc Registers new libtest source file lib1985.c.
tests/libtest/lib1985.c New libtest exercising easy-handle reuse across two hosts with different auth settings.
tests/data/Makefile.am Registers new testcase test1985.
tests/data/test1985 New testcase data to validate Digest behavior and request/response sequencing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/data/test1985
Comment thread lib/http_digest.c
@bagder bagder closed this in f30d9ef Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants