Skip to content

Commit

Permalink
feat: add gzip, deflate, brotli, zstd compressed for reqwest (#886)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <gaius.qi@gmail.com>
  • Loading branch information
gaius-qi authored Dec 5, 2024
1 parent 6e25a2f commit d8f0931
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 2 deletions.
53 changes: 53 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.123" }
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.123" }
thiserror = "1.0"
dragonfly-api = "=2.0.173"
reqwest = { version = "0.12.4", features = ["stream", "native-tls", "default-tls", "rustls-tls"] }
reqwest = { version = "0.12.4", features = ["stream", "native-tls", "default-tls", "rustls-tls", "gzip", "brotli", "zstd", "deflate"] }
reqwest-middleware = "0.4"
rcgen = { version = "0.12.1", features = ["x509-parser"] }
hyper = { version = "1.5", features = ["full"] }
Expand Down
8 changes: 8 additions & 0 deletions dragonfly-client-backend/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ impl HTTP {
.with_no_client_auth();

let client = reqwest::Client::builder()
.gzip(true)
.brotli(true)
.zstd(true)
.deflate(true)
.use_preconfigured_tls(client_config_builder)
.pool_max_idle_per_host(super::POOL_MAX_IDLE_PER_HOST)
.tcp_keepalive(super::KEEP_ALIVE_INTERVAL)
Expand Down Expand Up @@ -87,6 +91,10 @@ impl HTTP {
.with_no_client_auth();

let client = reqwest::Client::builder()
.gzip(true)
.brotli(true)
.zstd(true)
.deflate(true)
.use_preconfigured_tls(client_config_builder)
.build()?;

Expand Down
4 changes: 4 additions & 0 deletions dragonfly-client-backend/src/object_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ impl ObjectStorage {
pub fn new(scheme: Scheme) -> ClientResult<ObjectStorage> {
// Initialize the reqwest client.
let client = reqwest::Client::builder()
.gzip(true)
.brotli(true)
.zstd(true)
.deflate(true)
.pool_max_idle_per_host(super::POOL_MAX_IDLE_PER_HOST)
.tcp_keepalive(super::KEEP_ALIVE_INTERVAL)
.http2_keep_alive_timeout(super::HTTP2_KEEP_ALIVE_TIMEOUT)
Expand Down
2 changes: 1 addition & 1 deletion dragonfly-client-config/src/dfdaemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn default_download_rate_limit() -> ByteSize {
/// default_download_piece_timeout is the default timeout for downloading a piece from source.
#[inline]
fn default_download_piece_timeout() -> Duration {
Duration::from_secs(10)
Duration::from_secs(15)
}

/// default_download_concurrent_piece_count is the default number of concurrent pieces to download.
Expand Down

0 comments on commit d8f0931

Please sign in to comment.