I tried to use http 2.0 with reqwest:
But simple example, like this:
use reqwest::Client;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::builder()
.connection_verbose(true)
.http2_prior_knowledge()
.build()?;
let resp = client
.get("https://httpbin.org/ip")
.send()
.await?
.json::<HashMap<String, String>>()
.await?;
println!("{:#?}", resp);
Ok(())
}
give me error:
Error: reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("httpbin.org")), port: None, path: "/ip", query: None, fragment: None }, source: hyper::Error(Http2, Error { kind: GoAway(b"", FRAME_SIZE_ERROR, Library) }) }
while curl -v -v https://httpbin.org/ip
works just fine, and it shows that it uses HTTP/2.0
I tried to reduce size of "frame", but by default minium size is used (16KB),
also I tried .http2_adaptive_window(true)
, but this is changes nothing.
So any hint how to use HTTP/2.0 with reqwest ?