Bug Report
Version 0.1.1
└── tonic v0.1.1
Platform
Linux SherlockHolo 5.5.7-arch1-1 #1 SMP PREEMPT Sat, 29 Feb 2020 19:06:02 +0000 x86_64 GNU/Linux
Description
my dependencies is
http = "0.2"
tonic = { version = "0.1", features = ["transport", "tls"] }
tokio = { version = "0.2", features = ["rt-core", "macros", "sync", "time", "rt-util", "fs"] }
I try
use std::str::FromStr;
use std::time::Duration;
use http::Uri;
use tokio::fs;
use tonic::transport::{Certificate, Channel, ClientTlsConfig, Identity};
#[tokio::main]
async fn main() {
let uri = Uri::from_str("https://127.0.0.1:9876").unwrap();
let ca = fs::read("ca.pem").await.unwrap();
let ca = Certificate::from_pem(ca);
let key = fs::read("key.pem").await.unwrap();
let cert = fs::read("cert.pem").await.unwrap();
let identity = Identity::from_pem(cert, key);
let tls_config = ClientTlsConfig::new()
.ca_certificate(ca)
.identity(identity);
let channel = Channel::builder(uri)
.tls_config(tls_config)
.tcp_keepalive(Some(Duration::from_secs(5)))
.connect()
.await.unwrap();
}
and use nc -l 127.0.0.1 9876 to listen, it should connect success and nc will print something aboult tls handshake, but it failed with thread 'main' panicked at 'called Result::unwrap()on anErr value: tonic::transport::Error(Transport, hyper::Error(Connect, InvalidDNSNameError))', src/libcore/result.rs:1188:5.
If I use https://localhost:9876 it connects successfully and nc print something about tls handshake messages. It should not happen.
Bug Report
Version 0.1.1
Platform
Linux SherlockHolo 5.5.7-arch1-1 #1 SMP PREEMPT Sat, 29 Feb 2020 19:06:02 +0000 x86_64 GNU/Linux
Description
my dependencies is
I try
and use
nc -l 127.0.0.1 9876to listen, it should connect success and nc will print something aboult tls handshake, but it failed withthread 'main' panicked at 'calledResult::unwrap()on anErrvalue: tonic::transport::Error(Transport, hyper::Error(Connect, InvalidDNSNameError))', src/libcore/result.rs:1188:5.If I use
https://localhost:9876it connects successfully and nc print something about tls handshake messages. It should not happen.