Repository: seanmonstar/reqwest (language: rust)

Issue:
[socks5] Requests to onion services don't work: "No such host is known."
```rust
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    let proxy = reqwest::Proxy::all("socks5://127.0.0.1:9150")?;
    let client = reqwest::Client::builder().proxy(proxy).build()?;

    let res = client.get("https://www.bbcnewsv2vjtpsuy.onion/").send().await?;
    let body = res.text().await?;
    println!("body = {:?}", body);
}
```
I get the following error:
```
Error: reqwest::Error { kind: Request, url: "https://www.bbcnewsv2vjtpsuy.onion/", source: hyper::Error(Connect, Os { code: 11001, kind: Other, message: "No such host is known." }) }
error: process didn't exit successfully: `target\debug\rust_reqwest.exe` (exit code: 1)
```
I suspect that DNS doesn't go through the proxy. Please fix this. Or please tell me how to force DNS to go through the proxy.
[socks5] Requests to onion services don't work: "No such host is known."
```rust
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    let proxy = reqwest::Proxy::all("socks5://127.0.0.1:9150")?;
    let client = reqwest::Client::builder().proxy(proxy).build()?;

    let res = client.get("https://www.bbcnewsv2vjtpsuy.onion/").send().await?;
    let body = res.text().await?;
    println!("body = {:?}", body);
}
```
I get the following error:
```
Error: reqwest::Error { kind: Request, url: "https://www.bbcnewsv2vjtpsuy.onion/", source: hyper::Error(Connect, Os { code: 11001, kind: Other, message: "No such host is known." }) }
error: process didn't exit successfully: `target\debug\rust_reqwest.exe` (exit code: 1)
```
I suspect that DNS doesn't go through the proxy. Please fix this. Or please tell me how to force DNS to go through the proxy.


Discussion / hints:
I've found it myself: https://github.com/seanmonstar/reqwest/blob/6a41459862fa9db2a903542afcc06460cf39c277/src/proxy.rs#L322
https://github.com/seanmonstar/reqwest/blob/6a41459862fa9db2a903542afcc06460cf39c277/src/proxy.rs#L387
I should've used socks5h://127.0.0.1:9150 instead. Sorry.
But please update your example: https://github.com/seanmonstar/reqwest/blob/master/examples/tor_socks.rs
Btw, https://github.com/seanmonstar/reqwest/blob/6a41459862fa9db2a903542afcc06460cf39c277/src/proxy.rs#L320
are there any plans to make it non-blocking?
I've found it myself: https://github.com/seanmonstar/reqwest/blob/6a41459862fa9db2a903542afcc06460cf39c277/src/proxy.rs#L322
https://github.com/seanmonstar/reqwest/blob/6a41459862fa9db2a903542afcc06460cf39c277/src/proxy.rs#L387
I should've used socks5h://127.0.0.1:9150 instead. Sorry.
But please update your example: https://github.com/seanmonstar/reqwest/blob/master/examples/tor_socks.rs
Btw, https://github.com/seanmonstar/reqwest/blob/6a41459862fa9db2a903542afcc06460cf39c277/src/proxy.rs#L320
are there any plans to make it non-blocking?

Fix patch:
diff --git a/examples/tor_socks.rs b/examples/tor_socks.rs
index d80835baa..7b3985c1a 100644
--- a/examples/tor_socks.rs
+++ b/examples/tor_socks.rs
@@ -6,7 +6,7 @@
 #[tokio::main]
 async fn main() -> Result<(), reqwest::Error> {
     // Make sure you are running tor and this is your socks port
-    let proxy = reqwest::Proxy::all("socks5://127.0.0.1:9050").expect("tor proxy should be there");
+    let proxy = reqwest::Proxy::all("socks5h://127.0.0.1:9050").expect("tor proxy should be there");
     let client = reqwest::Client::builder()
         .proxy(proxy)
         .build()


Test patch: