Skip to content

Retries fatal connect error #271

Description

@barskern

Bug description

The reqwest-retry middleware retries a connect error which is not transient. This is happens on a "misconfiguration" of the features reqwest crate when building, though leads me to wonder that perhaps not all errors stemming from is_connect are indeed transient.

#[cfg(not(target_arch = "wasm32"))]
let is_connect = error.is_connect();
#[cfg(target_arch = "wasm32")]
let is_connect = false;
if error.is_timeout() || is_connect {
Some(Retryable::Transient)

To Reproduce

[package]
name = "reqwest-connect-error"
version = "0.1.0"
edition = "2024"

[dependencies]
reqwest = { version = "0.13.1", default-features = false }
tokio = { version = "1.49.0", features = ["full"] }
#[tokio::main]
async fn main()  {
    let client = reqwest::Client::new();
    let e = client.get("https://github.com").send().await.unwrap_err();
    eprintln!("{e:?}");
    eprintln!("is_connect: {}", e.is_connect());
}

Expected behavior

Expected the middleware to stop on the first try.

Environment

  • OS: Linux
  • Rust version: 1.92.0

Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions