| 289 | } |
| 290 | |
| 291 | fn call(&mut self, uri: hyper::Uri) -> Self::Future { |
| 292 | let tls_connector = self.tls_connector.clone(); |
| 293 | Box::pin(async move { |
| 294 | let host = uri.host().unwrap_or("localhost").to_string(); |
| 295 | let port = uri.port_u16().unwrap_or(443); |
| 296 | let addr = format!("{host}:{port}"); |
| 297 | let tcp = tokio::net::TcpStream::connect(addr).await?; |
| 298 | let server_name = ServerName::try_from(host)?; |
| 299 | let tls_stream = tls_connector.connect(server_name, tcp).await?; |
| 300 | Ok(hyper_util::rt::TokioIo::new(tls_stream)) |
| 301 | }) |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | pub fn build_insecure_rustls_config() -> Result<rustls::ClientConfig> { |