fix(http): use crate version for default User-Agent (tests 386, 430-432)#115
Merged
jonwiggins merged 1 commit intomainfrom Mar 27, 2026
Merged
Conversation
…ded 0.1.0
The default User-Agent was hardcoded as "curl/0.1.0" in h1, h2, h3, and
easy.rs (CONNECT proxy). After --next resets headers, subsequent request
groups fell back to this stale default instead of the actual version,
causing curl tests 386, 430, 431, 432 to fail.
Replace all instances with concat!("curl/", env!("CARGO_PKG_VERSION"))
so the default User-Agent always matches the crate version.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jonwiggins
added a commit
that referenced
this pull request
Mar 28, 2026
…ded 0.1.0 (#115) The default User-Agent was hardcoded as "curl/0.1.0" in h1, h2, h3, and easy.rs (CONNECT proxy). After --next resets headers, subsequent request groups fell back to this stale default instead of the actual version, causing curl tests 386, 430, 431, 432 to fail. Replace all instances with concat!("curl/", env!("CARGO_PKG_VERSION")) so the default User-Agent always matches the crate version. Co-authored-by: Optio Agent <optio-agent@noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jonwiggins
added a commit
that referenced
this pull request
Mar 28, 2026
…119) * fix(cli): use curl-compatible error message for --fail HTTP errors Change the fail_on_error error message from "HTTP error NNN (fail_on_error enabled)" to "The requested URL returned error: NNN" to match curl's %{errormsg} format. This fixes --write-out %{onerror} and %{urlnum} output to stderr (curl test 1188). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(http): use crate version for default User-Agent instead of hardcoded 0.1.0 (#115) The default User-Agent was hardcoded as "curl/0.1.0" in h1, h2, h3, and easy.rs (CONNECT proxy). After --next resets headers, subsequent request groups fell back to this stale default instead of the actual version, causing curl tests 386, 430, 431, 432 to fail. Replace all instances with concat!("curl/", env!("CARGO_PKG_VERSION")) so the default User-Agent always matches the crate version. Co-authored-by: Optio Agent <optio-agent@noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(cli): handle --fail HTTP errors in multi-URL mode for write-out and output When multiple URLs are used with --fail, the Easy handle's fail_on_error flag causes perform_async() to return an Err instead of Ok(response). The error branch was using a dummy response for write-out and not writing headers to the output file, which broke --write-out variables like %{onerror}, %{urlnum}, %{exitcode}, and %{errormsg} when combined with %{stderr}, and also broke --include output to files. Fix by detecting --fail HTTP errors (curl code 22) in the Err branch and using easy.last_response() to retrieve the actual response stored before the error was returned. This provides correct headers for --include output and proper response data for write-out variable expansion. Passes curl test 1188. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(cli): don't retry --fail HTTP errors in perform_with_retry When --fail causes perform() to return Err(Error::Http) for non-retriable HTTP status codes (like 404), the retry loop should not retry. Previously, the Err branch retried unconditionally, causing an extra request when --retry was used with --fail on non-retriable responses. (curl compat: test 752) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Optio Agent <optio-agent@noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
curl/0.1.0toconcat!("curl/", env!("CARGO_PKG_VERSION"))so it always matches the actual crate version--next+--configchaining where subsequent request groups (after--nextresets headers) fell back to the stale0.1.0default instead of0.2.2Test plan
--next)cargo fmtandcargo clippyclean🤖 Generated with Claude Code