Skip to content

fix(http): prevent connection reuse when --fail skips response body (test 1328)#131

Merged
jonwiggins merged 1 commit intomainfrom
optio/task-09e64aa0-9763-4e42-bd76-7f77fd1f690e
Mar 28, 2026
Merged

fix(http): prevent connection reuse when --fail skips response body (test 1328)#131
jonwiggins merged 1 commit intomainfrom
optio/task-09e64aa0-9763-4e42-bd76-7f77fd1f690e

Conversation

@jonwiggins
Copy link
Copy Markdown
Owner

Summary

  • When --fail triggers on a 4xx response with URL globbing, the body read is skipped but the connection was returned to the pool with unread body data still on the socket
  • The next URL's request would reuse that connection and read stale body data instead of fresh response headers, causing a hang
  • Fix: check fail_skip && has_body_framing (Content-Length or chunked) in the can_reuse calculation to prevent reusing connections with undrained body data

Closes #122

Test plan

  • Added unit test request_fail_on_error_no_reuse_with_body verifying can_reuse = false when --fail skips a 404 response with Content-Length
  • All existing tests pass (no regressions)
  • cargo clippy and cargo fmt pass
  • curl test 1328 should pass (requires curl test infrastructure)

🤖 Generated with Claude Code

…test 1328)

When --fail triggers on a 4xx response, the body read is skipped but
the connection was still returned to the pool. If the response had body
framing (Content-Length or chunked), the unread body data would corrupt
the next request on a reused connection, causing a hang with URL globbing.

Check for `fail_skip && has_body_framing` when computing `can_reuse` to
prevent reusing connections with stale body data on the socket.

Closes #122

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jonwiggins jonwiggins merged commit 9de3bf5 into main Mar 28, 2026
7 checks passed
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.

fix(http): --fail with URL globbing hangs (test 1328)

1 participant