Skip to content

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

Closed
jonwiggins wants to merge 1 commit intomainfrom
optio/task-221ff85a-c279-49de-bd8d-199ac2bd8c21
Closed

fix(http): prevent connection reuse when --fail skips response body (test 1328)#126
jonwiggins wants to merge 1 commit intomainfrom
optio/task-221ff85a-c279-49de-bd8d-199ac2bd8c21

Conversation

@jonwiggins
Copy link
Copy Markdown
Owner

Summary

  • When --fail is used with URL globbing and the first URL returns a 4xx error, urlx hangs instead of continuing to the next URL (curl test 1328)
  • Root cause: the response body is skipped (fail_skip = true) but the connection is returned to the pool with unread data still on the socket, corrupting the next request's HTTP parse
  • Fix: add !(fail_skip && has_body_framing) to the can_reuse condition in h1.rs, preventing connection reuse when the body was skipped but has Content-Length or chunked framing

Test plan

  • cargo check passes
  • cargo fmt -- --check passes
  • cargo test — all 345 unit tests + 8 doc-tests pass, zero regressions
  • ./scripts/run-curl-tests.sh 1328 — previously hung, should now pass

🤖 Generated with Claude Code

…test 1328)

When --fail triggers on a 4xx response with URL globbing, the body is
skipped but the connection was returned to the pool with unread data.
The next URL would then read stale body bytes as HTTP headers, causing
a hang. Disable connection reuse when fail_skip is true and the response
has body framing (Content-Length or chunked).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jonwiggins jonwiggins closed this Mar 28, 2026
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