ClSlaid commented on code in PR #1895:
URL: 
https://github.com/apache/incubator-opendal/pull/1895#discussion_r1161892646


##########
core/src/raw/http_util/client.rs:
##########
@@ -88,110 +77,11 @@ impl HttpClient {
         })
     }
 
-    /// Build a new blocking client with given builder.
-    ///
-    /// # Notes
-    ///
-    /// `reqwest::blocking::ClientBuilder::build` will panic if called
-    /// inside async context. So we need to spawn a thread to build it.
-    ///
-    /// And users SHOULD never call blocking clients in async context.
-    fn build_blocking_client(
-        mut builder: reqwest::blocking::ClientBuilder,
-    ) -> Result<reqwest::blocking::Client> {
-        // Make sure we don't enable auto gzip decompress.
-        builder = builder.no_gzip();
-        // Make sure we don't enable auto brotli decompress.
-        builder = builder.no_brotli();
-        // Make sure we don't enable auto deflate decompress.
-        builder = builder.no_deflate();
-        // Redirect will be handled by ourselves.
-        builder = builder.redirect(Policy::none());
-
-        #[cfg(feature = "trust-dns")]
-        let builder = builder.trust_dns(true);
-
-        thread::spawn(|| {
-            builder.build().map_err(|err| {
-                Error::new(ErrorKind::Unexpected, "blocking client build 
failed").set_source(err)
-            })
-        })
-        .join()
-        .expect("the thread of building blocking client join failed")
-    }
-
     /// Get the async client from http client.
     pub async fn async_client(&self) -> reqwest::Client {

Review Comment:
   Now that this is the only client, can we use 'client' directly?



##########
core/src/raw/http_util/client.rs:
##########
@@ -52,20 +48,13 @@ impl Debug for HttpClient {
 impl HttpClient {
     /// Create a new http client in async context.
     pub fn new() -> Result<Self> {
-        Self::build(
-            reqwest::ClientBuilder::new(),
-            reqwest::blocking::ClientBuilder::new(),
-        )
+        Self::build(reqwest::ClientBuilder::new())
     }
 
     /// Build a new http client in async context.
-    pub fn build(
-        async_builder: reqwest::ClientBuilder,
-        blocking_builder: reqwest::blocking::ClientBuilder,
-    ) -> Result<Self> {
+    pub fn build(async_builder: reqwest::ClientBuilder) -> Result<Self> {

Review Comment:
   Now that it is the only client, can we use 'builder' or 'client_builder' 
directly?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to