Giter VIP home page Giter VIP logo

Comments (6)

Jonathas-Conceicao avatar Jonathas-Conceicao commented on September 28, 2024 1

To be clear: http_client::native does not work with default-features = false, features = ["h1_client"] (And should not even be exposed?)

Looks like I mixed up the examples while I was reporting the issue, I meant to post one using http_client::h1::H1Client there. I've edited the original mensagem to fix this.

from http-client.

Fishrock123 avatar Fishrock123 commented on September 28, 2024

Does this work with http-client pinned to =6.0.0 and async-h1 pinned to =2.0.0 (or =2.1.2)?

from http-client.

Jonathas-Conceicao avatar Jonathas-Conceicao commented on September 28, 2024

I had to use patch since these versions were yanked from crates.io, but I think I got it right. Unfortunately neither the async-h1 versions worked. This is what I've tryed on the Cargo.toml

[dependencies]
async-std = { version = "1", features = ["attributes"] }
http-client = { version = "=6.0.0", default-features = false, features = ["h1_client"] }
async-h1 = "=2.1.2"
mockito = "0.29"
testcontainers = "0.12"

[patch.crates-io]
async-h1 = { git = 'https://github.com/http-rs/async-h1', tag = "v2.1.2" }

from http-client.

Fishrock123 avatar Fishrock123 commented on September 28, 2024

To be clear: http_client::native does not work with default-features = false, features = ["h1_client"] (And should not even be exposed?)

from http-client.

otavio avatar otavio commented on September 28, 2024

I debugged this issue a little and found that the code

http-client/src/h1/mod.rs

Lines 139 to 144 in db0025d

.socket_addrs(|| match req.url().scheme() {
"http" => Some(80),
#[cfg(any(feature = "native-tls", feature = "rustls"))]
"https" => Some(443),
_ => None,
})?
returns the list of addresses. On the other hand, however,
let stream = pool.get().await?;
returns on the first error instead of trying to connect to the next available address.

from http-client.

otavio avatar otavio commented on September 28, 2024

A integration test for this issue could be done using:

#[atest]
async fn fallback_to_ipv4() {
    let client = DefaultClient::new();
    let _mock_guard = mock("GET", "/")
        .with_status(200)
        .expect_at_least(2)
        .create();

    // Kips the initial "http://127.0.0.1:" to get only the port number
    let mock_port = &mockito::server_url()[17..];

    let url = &format!("http://localhost:{}", mock_port);
    let req = Request::new(http_types::Method::Get, Url::parse(url).unwrap());
    client.send(req.clone()).await.unwrap();
}

from http-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.