Fix rustls client/server filters (#401)

This commit is contained in:
Nikolay Kim 2024-08-26 16:00:48 +05:00 committed by GitHub
parent 9b24698087
commit c71678c999
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 27 additions and 25 deletions

View file

@ -1,5 +1,9 @@
# Changes # Changes
## [2.0.1] - 2024-08-26
* Fix rustls client/server filters
## [2.0.0] - 2024-05-28 ## [2.0.0] - 2024-05-28
* Use async fn for Service::ready() and Service::shutdown() * Use async fn for Service::ready() and Service::shutdown()

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ntex-tls" name = "ntex-tls"
version = "2.0.0" version = "2.0.1"
authors = ["ntex contributors <team@ntex.rs>"] authors = ["ntex contributors <team@ntex.rs>"]
description = "An implementation of SSL streams for ntex backed by OpenSSL" description = "An implementation of SSL streams for ntex backed by OpenSSL"
keywords = ["network", "framework", "async", "futures"] keywords = ["network", "framework", "async", "futures"]
@ -26,10 +26,10 @@ rustls = ["tls_rust"]
[dependencies] [dependencies]
ntex-bytes = "0.1" ntex-bytes = "0.1"
ntex-io = "2.0" ntex-io = "2"
ntex-util = "2.0" ntex-util = "2"
ntex-service = "3.0" ntex-service = "3"
ntex-net = "2.0" ntex-net = "2"
log = "0.4" log = "0.4"

View file

@ -104,17 +104,16 @@ impl FilterLayer for TlsClientFilter {
'outer: loop { 'outer: loop {
if !src.is_empty() { if !src.is_empty() {
src.split_to(session.writer().write(src)?); src.split_to(session.writer().write(src)?);
} else {
break; loop {
} match session.write_tls(&mut io) {
while session.wants_write() { Ok(0) => continue 'outer,
match session.write_tls(&mut io) { Ok(_) => continue,
Ok(0) => continue 'outer, Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => {
Ok(_) => continue, break
Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => { }
break Err(err) => return Err(err),
} }
Err(err) => return Err(err),
} }
} }
break; break;

View file

@ -112,17 +112,16 @@ impl FilterLayer for TlsServerFilter {
'outer: loop { 'outer: loop {
if !src.is_empty() { if !src.is_empty() {
src.split_to(session.writer().write(src)?); src.split_to(session.writer().write(src)?);
} else {
break; loop {
} match session.write_tls(&mut io) {
while session.wants_write() { Ok(0) => continue 'outer,
match session.write_tls(&mut io) { Ok(_) => continue,
Ok(0) => continue 'outer, Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => {
Ok(_) => continue, break
Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => { }
break Err(err) => return Err(err),
} }
Err(err) => return Err(err),
} }
} }
break; break;