diff --git a/examples/mbedtls/Cargo.toml b/examples/mbedtls/Cargo.toml index 5223c571..5db13d53 100644 --- a/examples/mbedtls/Cargo.toml +++ b/examples/mbedtls/Cargo.toml @@ -5,5 +5,5 @@ edition = "2021" [dependencies] -mbedtls = { version = "0.8.1" } +mbedtls = { version = "0.11.0" } ureq = { path = "../.." } \ No newline at end of file diff --git a/examples/mbedtls/src/mbedtls_connector.rs b/examples/mbedtls/src/mbedtls_connector.rs index 856db7ad..bf62a8af 100644 --- a/examples/mbedtls/src/mbedtls_connector.rs +++ b/examples/mbedtls/src/mbedtls_connector.rs @@ -1,3 +1,5 @@ +// This requires mbedtls crate 0.11.0 or newer due to +// new Context parameter use std::fmt; use std::io; use ureq::{Error, ReadWrite, TlsConnector}; @@ -14,7 +16,7 @@ fn entropy_new() -> mbedtls::rng::OsEntropy { } pub struct MbedTlsConnector { - context: Arc>, + context: Arc>>>, } #[derive(Debug)] @@ -59,9 +61,8 @@ impl TlsConnector for MbedTlsConnector { io: Box, ) -> Result, Error> { let mut ctx = self.context.lock().unwrap(); - let sync = SyncIo(Mutex::new(io)); - match ctx.establish(sync, None) { - Err(_) => { + match ctx.establish(io, None) { + Err(e) => { let io_err = io::Error::new(io::ErrorKind::InvalidData, MbedTlsError); return Err(io_err.into()); } @@ -92,7 +93,7 @@ impl io::Write for SyncIo { } struct MbedTlsStream { - context: Arc>, //tcp_stream: TcpStream, + context: Arc>>>, //tcp_stream: TcpStream, } impl fmt::Debug for MbedTlsStream {