I use reqwest to connect to an https server.
It works well with curl when disable the certificat verification with -k:
curl -X POST 'https://192.168.0.40:8080/' -H 'Content-Type: application/json' -d {"v":"k"} -v -k
However when i try with reqwest lile:
let client = reqwest::Client::builder()
.use_native_tls()
.build()?;
let res = client.post("/")
.body("body")
.send()
.await?;
I get the error:
Error: reqwest::Error { kind: Request, url: "https://192.168.0.40:8080/", source: hyper::Error(Connect, Ssl(Error { code: ErrorCode(1), cause: Some(Ssl(ErrorStack([Error { code: 336151578, library: "SSL routines", function: "ssl3_read_bytes", reason: "tlsv1 alert decode error", file: "../ssl/record/rec_layer_s3.c", line: 1543, data: "SSL alert number 50" }]))) }, X509VerifyResult { code: 0, error: "ok" })) }
Is there a way to tell reqwest to accept certificate that are no trusted. (I also try use_rustls_tls)
When using use_rustls_tls, the error is:
Error: reqwest::Error { kind: Request, url: "https://192.168.0.40:8080/", source: hyper::Error(Connect, Custom { kind: Other, error: "invalid dnsname" }) }
Which tell me that there is a problem with the domain name resolution.
Thanks