How to remove http2 support? #1505
-
I use both Before importing After importing Is it possible to remove http2 support to reduce size? [package]
name = "rs_test"
version = "0.1.0"
edition = "2021"
[dependencies]
axum = "0.4"
tokio = { version = "1.0", features = ["full"] }
# reqwest = "0.11" # add this line, and the size of release binary will increase 1.3MB use axum::{response::Html, routing::get, Router};
use std::net::SocketAddr;
#[tokio::main]
async fn main() {
let app:Router = Router::new().route("/", get(handler));
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
println!("listening on {}", addr);
axum::Server::bind(&addr)
.serve(app.into_make_service())
.await
.unwrap();
}
async fn handler() -> Html<&'static str> {
Html("<h1>Hello, World!</h1>")
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There currently isn't a way to disable HTTP/2 support in reqwest. In a way, reqwest was using its "opinionated client"-ness to say most people want it. But, since we do allow people to opt-in to a bunch of other things that are "hefty" to compile, it does make sense to make HTTP/2 (and HTTP/3 eventually) optional. It will require a breaking change release in reqwest, to make a feature optional. |
Beta Was this translation helpful? Give feedback.
There currently isn't a way to disable HTTP/2 support in reqwest. In a way, reqwest was using its "opinionated client"-ness to say most people want it.
But, since we do allow people to opt-in to a bunch of other things that are "hefty" to compile, it does make sense to make HTTP/2 (and HTTP/3 eventually) optional. It will require a breaking change release in reqwest, to make a feature optional.