diff --git a/ntex-tls/CHANGES.md b/ntex-tls/CHANGES.md index 224c8d6f..80dfd39f 100644 --- a/ntex-tls/CHANGES.md +++ b/ntex-tls/CHANGES.md @@ -1,5 +1,9 @@ # Changes +## [2.0.1] - 2024-08-26 + +* Fix rustls client/server filters + ## [2.0.0] - 2024-05-28 * Use async fn for Service::ready() and Service::shutdown() diff --git a/ntex-tls/Cargo.toml b/ntex-tls/Cargo.toml index c6ede013..415b427f 100644 --- a/ntex-tls/Cargo.toml +++ b/ntex-tls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ntex-tls" -version = "2.0.0" +version = "2.0.1" authors = ["ntex contributors "] description = "An implementation of SSL streams for ntex backed by OpenSSL" keywords = ["network", "framework", "async", "futures"] @@ -26,10 +26,10 @@ rustls = ["tls_rust"] [dependencies] ntex-bytes = "0.1" -ntex-io = "2.0" -ntex-util = "2.0" -ntex-service = "3.0" -ntex-net = "2.0" +ntex-io = "2" +ntex-util = "2" +ntex-service = "3" +ntex-net = "2" log = "0.4" diff --git a/ntex-tls/src/rustls/client.rs b/ntex-tls/src/rustls/client.rs index 0cd0be84..70a8c264 100644 --- a/ntex-tls/src/rustls/client.rs +++ b/ntex-tls/src/rustls/client.rs @@ -104,17 +104,16 @@ impl FilterLayer for TlsClientFilter { 'outer: loop { if !src.is_empty() { src.split_to(session.writer().write(src)?); - } else { - break; - } - while session.wants_write() { - match session.write_tls(&mut io) { - Ok(0) => continue 'outer, - Ok(_) => continue, - Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => { - break + + loop { + match session.write_tls(&mut io) { + Ok(0) => continue 'outer, + Ok(_) => continue, + Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => { + break + } + Err(err) => return Err(err), } - Err(err) => return Err(err), } } break; diff --git a/ntex-tls/src/rustls/server.rs b/ntex-tls/src/rustls/server.rs index 27bbb0e2..574183cd 100644 --- a/ntex-tls/src/rustls/server.rs +++ b/ntex-tls/src/rustls/server.rs @@ -112,17 +112,16 @@ impl FilterLayer for TlsServerFilter { 'outer: loop { if !src.is_empty() { src.split_to(session.writer().write(src)?); - } else { - break; - } - while session.wants_write() { - match session.write_tls(&mut io) { - Ok(0) => continue 'outer, - Ok(_) => continue, - Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => { - break + + loop { + match session.write_tls(&mut io) { + Ok(0) => continue 'outer, + Ok(_) => continue, + Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => { + break + } + Err(err) => return Err(err), } - Err(err) => return Err(err), } } break;