-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTPS requests with no certificate verification #182
Comments
Yes, that method is supposed to disable hostname verification. From what I've seen, it works as advertised. Do you have a specific problem? It would be useful to see some example code that fails, the error that you get, and what version and OS is this on. |
I used this simple https server: https://gist.github.com/dergachev/7028596 It is accessible via other clients. The code: use std::io::Read;
extern crate reqwest;
use reqwest::ClientBuilder;
fn main() {
let client = ClientBuilder::new().unwrap().danger_disable_hostname_verification().build().unwrap();
let mut res = client.get("https://localhost:4443/").unwrap().send();
match res {
Ok(mut correct_result) => {
let mut content = String::new();
correct_result.read_to_string(&mut content);
println!("{}", content);
}
Err(e) =>
println!("{}", e)
}
} The error: https://localhost:4443/: The trust policy was not trusted. |
Ah, you want to completely disable verification. That method doesn't do that, just verifying the hostname. You can use |
So there is no way to completely disable certificate verification, I see?) I would like to establish connections with no need to add any certificates (even self-signed). |
No, there isn't. In those cases, better to just not use HTTPS, because it's a lie. |
Yes, it kinda is) |
This would really be useful for some of us. Most libraries in other languages support this option. |
Since this issue is high in search results... working example with extern crate reqwest;
fn main() {
let res = reqwest::Client::builder()
.danger_accept_invalid_certs(true)
.build()
.unwrap()
.get("https://invalidcert.example.com")
.send()
.unwrap();
println!("res: is {}", res.status());
} |
I found |
sorry for the necrobump, but can these kind of features be used on a single request whilst still sharing the reqwest client. |
Could you teach me how to ignore ssl, please? |
@4aiman here is an example: reqwest::Client::builder()
.redirect(reqwest::redirect::Policy::none())
.danger_accept_invalid_certs(true).build().expect("couldn't initialize http reqwest client") you don't prolly don't need the redirect line unless you want to ignore redirects. also there was literally an example above. |
Thanks! |
@4aiman what is your problem exactly ? |
Is it possible now to make https requests with no cert verification? Call of danger_disable_hostname_verification() on ClientBuilder seems to have no effect in 0.7.2.
The text was updated successfully, but these errors were encountered: