Open normalllll opened 6 days ago
Can I skip DNS and use IP directly to access a domain name? I noticed this issue #561 mentioned DNS bypass.
Like this resolve does not working.
resolve
let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 443); let client = reqwest::ClientBuilder::new(). resolve("example.com", addr). tls_sni(false). use_rustls_tls(). build().unwrap(); client.request(reqwest::Method::GET, "https://example.com").send().await; ... ...
I saw this place using hyper::Request::builder, but it passed the uri argument directly.
hyper::Request::builder
uri
Then it returns the result for example.com instead of 127.0.0.1
example.com
127.0.0.1
<!doctype html> <html> <head> <title>Example Domain</title> <meta charset="utf-8" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style type="text/css"> body { background-color: #f0f0f2; margin: 0; padding: 0; font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; } div { width: 600px; margin: 5em auto; padding: 2em; background-color: #fdfdff; border-radius: 0.5em; box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02); } a:link, a:visited { color: #38488f; text-decoration: none; } @media (max-width: 700px) { div { margin: 0 auto; width: auto; } } </style> </head> <body> <div> <h1>Example Domain</h1> <p>This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.</p> <p><a href="https://www.iana.org/domains/example">More information...</a></p> </div> </body> </html>
I'm not sure I understand. Does ClientBuilder::resolve(domain, ip) not work?
ClientBuilder::resolve(domain, ip)
Yes, he doesn't work.
The expected behavior is to send a request to 127.0.0.1, but in fact, it still requests example.com
Can I skip DNS and use IP directly to access a domain name? I noticed this issue #561 mentioned DNS bypass.
Like this
resolve
does not working.I saw this place using![image](https://github.com/seanmonstar/reqwest/assets/147307373/617a3ca8-ca30-4006-bce2-df0b588fc32d)
hyper::Request::builder
, but it passed theuri
argument directly.Then it returns the result for
example.com
instead of127.0.0.1