@@ -12,7 +12,6 @@ use reqwest::Body;
1212use reqwest:: Response ;
1313use reqwest:: StatusCode ;
1414use reqwest:: header;
15- use reqwest_middleware:: ClientWithMiddleware ;
1615use serde:: Deserialize ;
1716use serde:: Serialize ;
1817use tokio:: sync:: broadcast;
@@ -22,6 +21,7 @@ use url::Url;
2221use crate :: BLOCK_SIZE_THRESHOLD ;
2322use crate :: Config ;
2423use crate :: Error ;
24+ use crate :: HttpClient ;
2525use crate :: ONE_MEBIBYTE ;
2626use crate :: Result ;
2727use crate :: TransferEvent ;
@@ -30,7 +30,6 @@ use crate::UrlExt;
3030use crate :: backend:: StorageBackend ;
3131use crate :: backend:: Upload ;
3232use crate :: generator:: Alphanumeric ;
33- use crate :: new_http_client;
3433use crate :: streams:: ByteStream ;
3534use crate :: streams:: TransferStream ;
3635
@@ -179,7 +178,7 @@ impl ResponseExt for Response {
179178/// Represents an upload of a blob to Azure Blob Storage.
180179pub struct AzureBlobUpload {
181180 /// The HTTP client to use for the upload.
182- client : ClientWithMiddleware ,
181+ client : HttpClient ,
183182 /// The blob URL.
184183 url : Url ,
185184 /// The Azure block id.
@@ -191,7 +190,7 @@ pub struct AzureBlobUpload {
191190impl AzureBlobUpload {
192191 /// Constructs a new blob upload.
193192 fn new (
194- client : ClientWithMiddleware ,
193+ client : HttpClient ,
195194 url : Url ,
196195 block_id : Arc < String > ,
197196 events : Option < broadcast:: Sender < TransferEvent > > ,
@@ -304,24 +303,22 @@ pub struct AzureBlobStorageBackend {
304303 /// The config to use for transferring files.
305304 config : Config ,
306305 /// The HTTP client to use for transferring files.
307- client : ClientWithMiddleware ,
308- /// The HTTP cache used by the client.
309- ///
310- /// This is `None` if caching is not enabled.
311- cache : Option < Arc < Cache < DefaultCacheStorage > > > ,
306+ client : HttpClient ,
312307 /// The channel for sending transfer events.
313308 events : Option < broadcast:: Sender < TransferEvent > > ,
314309}
315310
316311impl AzureBlobStorageBackend {
317312 /// Constructs a new Azure Blob Storage backend with the given configuration
318313 /// and events channel.
319- pub fn new ( config : Config , events : Option < broadcast:: Sender < TransferEvent > > ) -> Self {
320- let ( client, cache) = new_http_client ( & config) ;
314+ pub fn new (
315+ config : Config ,
316+ client : HttpClient ,
317+ events : Option < broadcast:: Sender < TransferEvent > > ,
318+ ) -> Self {
321319 Self {
322320 config,
323321 client,
324- cache,
325322 events,
326323 }
327324 }
@@ -335,7 +332,7 @@ impl StorageBackend for AzureBlobStorageBackend {
335332 }
336333
337334 fn cache ( & self ) -> Option < & Cache < DefaultCacheStorage > > {
338- self . cache . as_deref ( )
335+ self . client . cache ( )
339336 }
340337
341338 fn events ( & self ) -> & Option < broadcast:: Sender < TransferEvent > > {
0 commit comments