From 91559e140429a855e8e7b38deeab9f45f4ebaf75 Mon Sep 17 00:00:00 2001 From: Optio Agent Date: Sat, 28 Mar 2026 03:06:02 +0000 Subject: [PATCH] fix(http): reset is_ntlm_probe after Type 3 auth to prevent duplicate request The is_ntlm_probe flag was set to true at the start of an NTLM exchange but never reset after the Type 3 authentication completed. This caused the probe-retry logic to sometimes fire on the already-successful 200 response, sending a spurious third request that broke protocol traces. Fixes #121 Co-Authored-By: Claude Opus 4.6 (1M context) --- crates/liburlx/src/easy.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/liburlx/src/easy.rs b/crates/liburlx/src/easy.rs index 3324850..cc3ad59 100644 --- a/crates/liburlx/src/easy.rs +++ b/crates/liburlx/src/easy.rs @@ -3480,7 +3480,7 @@ async fn perform_transfer( // For NTLM, send Content-Length: 0 (body will be sent after Type3). let is_challenge_response = !has_digest_state && auth_credentials.as_ref().is_some_and(|a| matches!(a.method, AuthMethod::Digest)); - let is_ntlm_probe = + let mut is_ntlm_probe = auth_credentials.as_ref().is_some_and(|a| matches!(a.method, AuthMethod::Ntlm)); let initial_body = if is_challenge_response || is_ntlm_probe { if current_body.is_some() { @@ -4229,6 +4229,11 @@ async fn perform_transfer( fail_on_error, )) .await?; + + // NTLM Type 3 auth complete — reset probe flag so the + // probe-retry logic (line ~3638) does not re-send the + // request on the already-successful 200 response. + is_ntlm_probe = false; } } }