Quick question, does reqwest allow self-signed certificates? I have created a tls enabled rust-warp webserver. And I have created a reqwest client to make requests to this server for testing purposes. The cert added to add_root_certificate
is the same certificate which the server is using. It's odd because when I use other clients such as Python or CURL there are no issues making the requests, and I do not get a TLS error on my server.
Here's my sample rust code:
let mut buf = Vec::new();File::open("my_cert.pem")? .read_to_end(&mut buf)?;let cert = reqwest::Certificate::from_pem(&buf)?;let client = reqwest::Client::builder() .add_root_certificate(cert) .build()?;let mut map = HashMap::new();map.insert("name", "John");let res = client.post("https://IP:PORT/endpoint").json(&map).send().await?;
And here's my sample Python code:
path_to_cert = "path/to/cert/my_cert.pem"route = "https://IP:PORT/endpoint"payload = {"name": "John",}res = requests.post(url, data = json.dumps(payload), verify=path_to_cert)
Not sure what is causing this issue? Any help would be greatly appreciated, thank you!
I have built a rust-warp server, and I am posting data to it for testing. I expect my rust-request to successfully post data to my server, but my server logs:
TLS alert received AlertMessagePayload {level: Fatal,description: CertificateUnknown,}