diff --git a/ntex-tls/Cargo.toml b/ntex-tls/Cargo.toml index b2ec41a9..4daab9e6 100644 --- a/ntex-tls/Cargo.toml +++ b/ntex-tls/Cargo.toml @@ -42,4 +42,4 @@ tls_rust = { version = "0.21", package = "rustls", optional = true } ntex = { version = "0.7.0", features = ["openssl", "rustls", "tokio"] } env_logger = "0.10" rustls-pemfile = "1.0" -webpki-roots = "0.23" +webpki-roots = "0.25" diff --git a/ntex-tls/examples/rustls-client.rs b/ntex-tls/examples/rustls-client.rs index c9776a91..ef1ac17b 100644 --- a/ntex-tls/examples/rustls-client.rs +++ b/ntex-tls/examples/rustls-client.rs @@ -10,15 +10,13 @@ async fn main() -> io::Result<()> { // rustls config let mut cert_store = RootCertStore::empty(); - cert_store.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map( - |ta| { - OwnedTrustAnchor::from_subject_spki_name_constraints( - ta.subject, - ta.spki, - ta.name_constraints, - ) - }, - )); + cert_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| { + OwnedTrustAnchor::from_subject_spki_name_constraints( + ta.subject, + ta.spki, + ta.name_constraints, + ) + })); let config = ClientConfig::builder() .with_safe_defaults() .with_root_certificates(cert_store) diff --git a/ntex/CHANGES.md b/ntex/CHANGES.md index 035fdc29..8daa4a75 100644 --- a/ntex/CHANGES.md +++ b/ntex/CHANGES.md @@ -1,6 +1,6 @@ # Changes -## [0.7.6] - 2023-10-xx +## [0.7.6] - 2023-10-16 * Upgrade ntex-h2 to 0.4 diff --git a/ntex/Cargo.toml b/ntex/Cargo.toml index 8439ec09..d199b625 100644 --- a/ntex/Cargo.toml +++ b/ntex/Cargo.toml @@ -71,9 +71,9 @@ bitflags = "2.4" log = "0.4" num_cpus = "1.13" nanorand = { version = "0.7.0", default-features = false, features = ["std", "wyrand"] } -polling = "2.5.1" +polling = "3.2.0" pin-project-lite = "0.2" -regex = { version = "1.7.0", default-features = false, features = ["std"] } +regex = { version = "1.10.1", default-features = false, features = ["std"] } sha-1 = "0.10" serde = { version = "1.0", features=["derive"] } socket2 = "0.5" @@ -95,7 +95,7 @@ tls-openssl = { version="0.10", package = "openssl", optional = true } # rustls tls-rustls = { version = "0.21", package = "rustls", optional = true } -webpki-roots = { version = "0.23", optional = true } +webpki-roots = { version = "0.25.2", optional = true } # compression brotli2 = { version="0.3.2", optional = true } @@ -109,4 +109,4 @@ futures-util = "0.3" tls-openssl = { version="0.10", package = "openssl" } tls-rustls = { version = "0.21", package="rustls", features = ["dangerous_configuration"] } rustls-pemfile = "1.0" -webpki-roots = "0.23" +webpki-roots = "0.25" diff --git a/ntex/src/server/accept.rs b/ntex/src/server/accept.rs index 1ac666ef..38aab4a1 100644 --- a/ntex/src/server/accept.rs +++ b/ntex/src/server/accept.rs @@ -1,8 +1,7 @@ -use std::{ - cell::Cell, fmt, io, sync::mpsc, sync::Arc, thread, time::Duration, time::Instant, -}; +use std::time::{Duration, Instant}; +use std::{cell::Cell, fmt, io, num::NonZeroUsize, sync::mpsc, sync::Arc, thread}; -use polling::{Event, Poller}; +use polling::{Event, Events, Poller}; use crate::rt::System; use crate::time::{sleep, Millis}; @@ -202,7 +201,7 @@ impl Accept { } // Create storage for events - let mut events = Vec::with_capacity(128); + let mut events = Events::with_capacity(NonZeroUsize::new(512).unwrap()); loop { if let Err(e) = self.poller.wait(&mut events, None) { @@ -241,7 +240,7 @@ impl Accept { let result = if info.registered.get() { self.poller.modify(&info.sock, Event::readable(idx)) } else { - self.poller.add(&info.sock, Event::readable(idx)) + unsafe { self.poller.add(&info.sock, Event::readable(idx)) } }; if let Err(err) = result { if err.kind() == io::ErrorKind::WouldBlock { diff --git a/ntex/src/server/socket.rs b/ntex/src/server/socket.rs index 703b7fc5..540213c1 100644 --- a/ntex/src/server/socket.rs +++ b/ntex/src/server/socket.rs @@ -107,8 +107,18 @@ impl Listener { #[cfg(unix)] mod listener_impl { use super::*; + use std::os::fd::{AsFd, BorrowedFd}; use std::os::unix::io::{AsRawFd, RawFd}; + impl AsFd for Listener { + fn as_fd(&self) -> BorrowedFd<'_> { + match *self { + Listener::Tcp(ref lst) => lst.as_fd(), + Listener::Uds(ref lst) => lst.as_fd(), + } + } + } + impl AsRawFd for Listener { fn as_raw_fd(&self) -> RawFd { match *self { @@ -122,7 +132,15 @@ mod listener_impl { #[cfg(windows)] mod listener_impl { use super::*; - use std::os::windows::io::{AsRawSocket, RawSocket}; + use std::os::windows::io::{AsRawSocket, AsSocket, BorrowedSocket, RawSocket}; + + impl AsSocket for Listener { + fn as_socket(&self) -> BorrowedSocket<'_> { + match *self { + Listener::Tcp(ref lst) => lst.as_socket(), + } + } + } impl AsRawSocket for Listener { fn as_raw_socket(&self) -> RawSocket {