Summary
Curl test 150 (HTTP with NTLM authorization and --fail) fails intermittently (~40% failure rate). urlx sometimes sends a spurious third HTTP request after NTLM authentication completes successfully.
Expected behavior
With --ntlm --fail, urlx should send exactly 2 requests:
- GET with
Authorization: NTLM <Type1> (negotiate)
- GET with
Authorization: NTLM <Type3> (authenticate)
Actual behavior
urlx sometimes sends 3 requests — duplicating request #2 (the NTLM Type 3 auth request). The test runner sees the extra request in the protocol trace and fails the test.
Root cause
In crates/liburlx/src/easy.rs, the is_ntlm_probe flag is set to true at the start of an NTLM exchange (~line 3483) but is never reset after the Type 3 auth succeeds. After the 200 response returns, the probe-retry logic (~line 3638) checks:
if (is_challenge_response || is_ntlm_probe)
&& response.status() != 401
&& !response.is_redirect()
{
if let Some(body) = current_body.as_deref() {
if !body.is_empty() {
// Sends a THIRD request with the full body
Since is_ntlm_probe is still true, the status is 200 (not 401), and there is a body, the code sends a spurious third request.
Suggested fix
Reset is_ntlm_probe = false after the NTLM Type 3 authentication completes (~line 4231), so the probe-retry path doesn't fire on the already-successful response.
Reproduction
./scripts/run-curl-tests.sh 150 # fails ~40% of the time
Summary
Curl test 150 (
HTTP with NTLM authorization and --fail) fails intermittently (~40% failure rate). urlx sometimes sends a spurious third HTTP request after NTLM authentication completes successfully.Expected behavior
With
--ntlm --fail, urlx should send exactly 2 requests:Authorization: NTLM <Type1>(negotiate)Authorization: NTLM <Type3>(authenticate)Actual behavior
urlx sometimes sends 3 requests — duplicating request #2 (the NTLM Type 3 auth request). The test runner sees the extra request in the protocol trace and fails the test.
Root cause
In
crates/liburlx/src/easy.rs, theis_ntlm_probeflag is set totrueat the start of an NTLM exchange (~line 3483) but is never reset after the Type 3 auth succeeds. After the 200 response returns, the probe-retry logic (~line 3638) checks:Since
is_ntlm_probeis stilltrue, the status is 200 (not 401), and there is a body, the code sends a spurious third request.Suggested fix
Reset
is_ntlm_probe = falseafter the NTLM Type 3 authentication completes (~line 4231), so the probe-retry path doesn't fire on the already-successful response.Reproduction
./scripts/run-curl-tests.sh 150 # fails ~40% of the time