mirror of
https://github.com/fafhrd91/actix-net
synced 2025-01-18 13:01:49 +01:00
bump MSRV to 1.65 (#485)
This commit is contained in:
parent
177590a7d8
commit
8d5d1dbf6f
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
- { name: Windows (MinGW), os: windows-latest, triple: x86_64-pc-windows-gnu }
|
- { name: Windows (MinGW), os: windows-latest, triple: x86_64-pc-windows-gnu }
|
||||||
- { name: Windows (32-bit), os: windows-latest, triple: i686-pc-windows-msvc }
|
- { name: Windows (32-bit), os: windows-latest, triple: i686-pc-windows-msvc }
|
||||||
version:
|
version:
|
||||||
- 1.60.0
|
- 1.65.0 # MSRV
|
||||||
- stable
|
- stable
|
||||||
|
|
||||||
name: ${{ matrix.target.name }} / ${{ matrix.version }}
|
name: ${{ matrix.target.name }} / ${{ matrix.version }}
|
||||||
|
3
.rustfmt.toml
Normal file
3
.rustfmt.toml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
group_imports = "StdExternalCrate"
|
||||||
|
imports_granularity = "Crate"
|
||||||
|
use_field_init_shorthand = true
|
@ -14,6 +14,10 @@ members = [
|
|||||||
]
|
]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
[workspace.package]
|
||||||
|
edition = "2021"
|
||||||
|
rust-version = "1.65"
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
actix-codec = { path = "actix-codec" }
|
actix-codec = { path = "actix-codec" }
|
||||||
actix-macros = { path = "actix-macros" }
|
actix-macros = { path = "actix-macros" }
|
||||||
|
@ -13,7 +13,7 @@ See example folders for [`actix-server`](./actix-server/examples) and [`actix-tl
|
|||||||
|
|
||||||
## MSRV
|
## MSRV
|
||||||
|
|
||||||
Crates in this repo currently have a Minimum Supported Rust Version (MSRV) of 1.60. As a policy, we permit MSRV increases in non-breaking releases.
|
Crates in this repo currently have a Minimum Supported Rust Version (MSRV) of 1.65. As a policy, we permit MSRV increases in non-breaking releases.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased - 2023-xx-xx
|
## Unreleased - 2023-xx-xx
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.60.
|
- Minimum supported Rust version (MSRV) is now 1.65.
|
||||||
|
|
||||||
## 0.5.1 - 2022-03-15
|
## 0.5.1 - 2022-03-15
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ keywords = ["network", "framework", "async", "futures"]
|
|||||||
repository = "https://github.com/actix/actix-net"
|
repository = "https://github.com/actix/actix-net"
|
||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition.workspace = true
|
||||||
rust-version = "1.60"
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "2"
|
bitflags = "2"
|
||||||
|
@ -234,10 +234,7 @@ impl<T, U> Framed<T, U> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Flush write buffer to underlying I/O stream.
|
/// Flush write buffer to underlying I/O stream.
|
||||||
pub fn flush<I>(
|
pub fn flush<I>(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), U::Error>>
|
||||||
mut self: Pin<&mut Self>,
|
|
||||||
cx: &mut Context<'_>,
|
|
||||||
) -> Poll<Result<(), U::Error>>
|
|
||||||
where
|
where
|
||||||
T: AsyncWrite,
|
T: AsyncWrite,
|
||||||
U: Encoder<I>,
|
U: Encoder<I>,
|
||||||
@ -270,10 +267,7 @@ impl<T, U> Framed<T, U> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Flush write buffer and shutdown underlying I/O stream.
|
/// Flush write buffer and shutdown underlying I/O stream.
|
||||||
pub fn close<I>(
|
pub fn close<I>(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), U::Error>>
|
||||||
mut self: Pin<&mut Self>,
|
|
||||||
cx: &mut Context<'_>,
|
|
||||||
) -> Poll<Result<(), U::Error>>
|
|
||||||
where
|
where
|
||||||
T: AsyncWrite,
|
T: AsyncWrite,
|
||||||
U: Encoder<I>,
|
U: Encoder<I>,
|
||||||
|
@ -11,14 +11,18 @@
|
|||||||
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
|
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
|
||||||
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
|
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
|
||||||
|
|
||||||
|
pub use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||||
|
pub use tokio_util::{
|
||||||
|
codec::{Decoder, Encoder},
|
||||||
|
io::poll_read_buf,
|
||||||
|
};
|
||||||
|
|
||||||
mod bcodec;
|
mod bcodec;
|
||||||
mod framed;
|
mod framed;
|
||||||
mod lines;
|
mod lines;
|
||||||
|
|
||||||
pub use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
pub use self::{
|
||||||
pub use tokio_util::codec::{Decoder, Encoder};
|
bcodec::BytesCodec,
|
||||||
pub use tokio_util::io::poll_read_buf;
|
framed::{Framed, FramedParts},
|
||||||
|
lines::LinesCodec,
|
||||||
pub use self::bcodec::BytesCodec;
|
};
|
||||||
pub use self::framed::{Framed, FramedParts};
|
|
||||||
pub use self::lines::LinesCodec;
|
|
||||||
|
@ -81,10 +81,7 @@ impl AsyncWrite for Bilateral {
|
|||||||
other => Ready(other),
|
other => Ready(other),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn poll_shutdown(
|
fn poll_shutdown(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), io::Error>> {
|
||||||
self: Pin<&mut Self>,
|
|
||||||
_cx: &mut Context<'_>,
|
|
||||||
) -> Poll<Result<(), io::Error>> {
|
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
## Unreleased - 2023-xx-xx
|
## Unreleased - 2023-xx-xx
|
||||||
|
|
||||||
- Update `syn` dependency to `2`.
|
- Update `syn` dependency to `2`.
|
||||||
- Minimum supported Rust version (MSRV) is now 1.60.
|
- Minimum supported Rust version (MSRV) is now 1.65.
|
||||||
|
|
||||||
## 0.2.3 - 2021-10-19
|
## 0.2.3 - 2021-10-19
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ description = "Macros for Actix system and runtime"
|
|||||||
repository = "https://github.com/actix/actix-net.git"
|
repository = "https://github.com/actix/actix-net.git"
|
||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition.workspace = true
|
||||||
rust-version = "1.60"
|
rust-version.workspace = true
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#[rustversion::stable(1.60)] // MSRV
|
#[rustversion::stable(1.65)] // MSRV
|
||||||
#[test]
|
#[test]
|
||||||
fn compile_macros() {
|
fn compile_macros() {
|
||||||
let t = trybuild::TestCases::new();
|
let t = trybuild::TestCases::new();
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
error: the async keyword is missing from the function declaration
|
error: the async keyword is missing from the function declaration
|
||||||
--> $DIR/main-02-only-async.rs:2:1
|
--> tests/trybuild/main-02-only-async.rs:2:1
|
||||||
|
|
|
|
||||||
2 | fn main() {
|
2 | fn main() {
|
||||||
| ^^
|
| ^^
|
||||||
|
|
||||||
error[E0601]: `main` function not found in crate `$CRATE`
|
error[E0601]: `main` function not found in crate `$CRATE`
|
||||||
--> $DIR/main-02-only-async.rs:1:1
|
--> tests/trybuild/main-02-only-async.rs:4:2
|
||||||
|
|
|
|
||||||
1 | / #[actix_rt::main]
|
4 | }
|
||||||
2 | | fn main() {
|
| ^ consider adding a `main` function to `$DIR/tests/trybuild/main-02-only-async.rs`
|
||||||
3 | | futures_util::future::ready(()).await
|
|
||||||
4 | | }
|
|
||||||
| |_^ consider adding a `main` function to `$DIR/tests/trybuild/main-02-only-async.rs`
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased - 2023-xx-xx
|
## Unreleased - 2023-xx-xx
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.60.
|
- Minimum supported Rust version (MSRV) is now 1.65.
|
||||||
|
|
||||||
## 2.8.0 - 2022-12-21
|
## 2.8.0 - 2022-12-21
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ homepage = "https://actix.rs"
|
|||||||
repository = "https://github.com/actix/actix-net.git"
|
repository = "https://github.com/actix/actix-net.git"
|
||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition.workspace = true
|
||||||
rust-version = "1.60"
|
rust-version.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["macros"]
|
default = ["macros"]
|
||||||
|
@ -20,8 +20,7 @@ fn main() {
|
|||||||
let make_service =
|
let make_service =
|
||||||
make_service_fn(|_conn| async { Ok::<_, Infallible>(service_fn(handle)) });
|
make_service_fn(|_conn| async { Ok::<_, Infallible>(service_fn(handle)) });
|
||||||
|
|
||||||
let server =
|
let server = Server::bind(&SocketAddr::from(([127, 0, 0, 1], 3000))).serve(make_service);
|
||||||
Server::bind(&SocketAddr::from(([127, 0, 0, 1], 3000))).serve(make_service);
|
|
||||||
|
|
||||||
if let Err(err) = server.await {
|
if let Err(err) = server.await {
|
||||||
eprintln!("server error: {}", err);
|
eprintln!("server error: {}", err);
|
||||||
|
@ -99,8 +99,7 @@ impl Arbiter {
|
|||||||
#[allow(clippy::new_without_default)]
|
#[allow(clippy::new_without_default)]
|
||||||
pub fn new() -> Arbiter {
|
pub fn new() -> Arbiter {
|
||||||
Self::with_tokio_rt(|| {
|
Self::with_tokio_rt(|| {
|
||||||
crate::runtime::default_tokio_runtime()
|
crate::runtime::default_tokio_runtime().expect("Cannot create new Arbiter's Runtime.")
|
||||||
.expect("Cannot create new Arbiter's Runtime.")
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,9 +148,7 @@ impl Arbiter {
|
|||||||
.send(SystemCommand::DeregisterArbiter(arb_id));
|
.send(SystemCommand::DeregisterArbiter(arb_id));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|err| {
|
.unwrap_or_else(|err| panic!("Cannot spawn Arbiter's thread: {name:?}: {err:?}"));
|
||||||
panic!("Cannot spawn Arbiter's thread: {:?}. {:?}", &name, err)
|
|
||||||
});
|
|
||||||
|
|
||||||
ready_rx.recv().unwrap();
|
ready_rx.recv().unwrap();
|
||||||
|
|
||||||
@ -201,9 +198,7 @@ impl Arbiter {
|
|||||||
.send(SystemCommand::DeregisterArbiter(arb_id));
|
.send(SystemCommand::DeregisterArbiter(arb_id));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|err| {
|
.unwrap_or_else(|err| panic!("Cannot spawn Arbiter's thread: {name:?}: {err:?}"));
|
||||||
panic!("Cannot spawn Arbiter's thread: {:?}. {:?}", &name, err)
|
|
||||||
});
|
|
||||||
|
|
||||||
ready_rx.recv().unwrap();
|
ready_rx.recv().unwrap();
|
||||||
|
|
||||||
|
@ -65,9 +65,11 @@ mod system;
|
|||||||
pub use tokio::pin;
|
pub use tokio::pin;
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
|
|
||||||
pub use self::arbiter::{Arbiter, ArbiterHandle};
|
pub use self::{
|
||||||
pub use self::runtime::Runtime;
|
arbiter::{Arbiter, ArbiterHandle},
|
||||||
pub use self::system::{System, SystemRunner};
|
runtime::Runtime,
|
||||||
|
system::{System, SystemRunner},
|
||||||
|
};
|
||||||
|
|
||||||
pub mod signal {
|
pub mod signal {
|
||||||
//! Asynchronous signal handling (Tokio re-exports).
|
//! Asynchronous signal handling (Tokio re-exports).
|
||||||
@ -89,12 +91,13 @@ pub mod net {
|
|||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use tokio::io::Ready;
|
|
||||||
use tokio::io::{AsyncRead, AsyncWrite, Interest};
|
use tokio::io::{AsyncRead, AsyncWrite, Interest};
|
||||||
pub use tokio::net::UdpSocket;
|
|
||||||
pub use tokio::net::{TcpListener, TcpSocket, TcpStream};
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub use tokio::net::{UnixDatagram, UnixListener, UnixStream};
|
pub use tokio::net::{UnixDatagram, UnixListener, UnixStream};
|
||||||
|
pub use tokio::{
|
||||||
|
io::Ready,
|
||||||
|
net::{TcpListener, TcpSocket, TcpStream, UdpSocket},
|
||||||
|
};
|
||||||
|
|
||||||
/// Extension trait over async read+write types that can also signal readiness.
|
/// Extension trait over async read+write types that can also signal readiness.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
@ -153,10 +156,9 @@ pub mod net {
|
|||||||
pub mod time {
|
pub mod time {
|
||||||
//! Utilities for tracking time (Tokio re-exports).
|
//! Utilities for tracking time (Tokio re-exports).
|
||||||
|
|
||||||
pub use tokio::time::Instant;
|
pub use tokio::time::{
|
||||||
pub use tokio::time::{interval, interval_at, Interval};
|
interval, interval_at, sleep, sleep_until, timeout, Instant, Interval, Sleep, Timeout,
|
||||||
pub use tokio::time::{sleep, sleep_until, Sleep};
|
};
|
||||||
pub use tokio::time::{timeout, Timeout};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod task {
|
pub mod task {
|
||||||
|
@ -226,9 +226,7 @@ impl SystemRunner {
|
|||||||
|
|
||||||
/// Runs the event loop until [stopped](System::stop_with_code), returning the exit code.
|
/// Runs the event loop until [stopped](System::stop_with_code), returning the exit code.
|
||||||
pub fn run_with_code(self) -> io::Result<i32> {
|
pub fn run_with_code(self) -> io::Result<i32> {
|
||||||
unimplemented!(
|
unimplemented!("SystemRunner::run_with_code is not implemented for io-uring feature yet");
|
||||||
"SystemRunner::run_with_code is not implemented for io-uring feature yet"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs the provided future, blocking the current thread until the future completes.
|
/// Runs the provided future, blocking the current thread until the future completes.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased - 2023-xx-xx
|
## Unreleased - 2023-xx-xx
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.60.
|
- Minimum supported Rust version (MSRV) is now 1.65.
|
||||||
|
|
||||||
## 2.2.0 - 2022-12-21
|
## 2.2.0 - 2022-12-21
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ categories = ["network-programming", "asynchronous"]
|
|||||||
homepage = "https://actix.rs"
|
homepage = "https://actix.rs"
|
||||||
repository = "https://github.com/actix/actix-net.git"
|
repository = "https://github.com/actix/actix-net.git"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition.workspace = true
|
||||||
rust-version = "1.60"
|
rust-version.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
@ -28,7 +28,7 @@ futures-core = { version = "0.3.17", default-features = false, features = ["allo
|
|||||||
futures-util = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
futures-util = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
||||||
mio = { version = "0.8", features = ["os-poll", "net"] }
|
mio = { version = "0.8", features = ["os-poll", "net"] }
|
||||||
num_cpus = "1.13"
|
num_cpus = "1.13"
|
||||||
socket2 = "0.4.2" # TODO(MSRV 1.64) update to 0.5
|
socket2 = "0.5"
|
||||||
tokio = { version = "1.23.1", features = ["sync"] }
|
tokio = { version = "1.23.1", features = ["sync"] }
|
||||||
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
|
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
|
||||||
|
|
||||||
|
@ -7,9 +7,7 @@ use tracing::{info, trace};
|
|||||||
use crate::{
|
use crate::{
|
||||||
server::ServerCommand,
|
server::ServerCommand,
|
||||||
service::{InternalServiceFactory, ServerServiceFactory, StreamNewService},
|
service::{InternalServiceFactory, ServerServiceFactory, StreamNewService},
|
||||||
socket::{
|
socket::{create_mio_tcp_listener, MioListener, MioTcpListener, StdTcpListener, ToSocketAddrs},
|
||||||
create_mio_tcp_listener, MioListener, MioTcpListener, StdTcpListener, ToSocketAddrs,
|
|
||||||
},
|
|
||||||
worker::ServerWorkerConfig,
|
worker::ServerWorkerConfig,
|
||||||
Server,
|
Server,
|
||||||
};
|
};
|
||||||
@ -246,8 +244,7 @@ impl ServerBuilder {
|
|||||||
use std::net::{IpAddr, Ipv4Addr};
|
use std::net::{IpAddr, Ipv4Addr};
|
||||||
lst.set_nonblocking(true)?;
|
lst.set_nonblocking(true)?;
|
||||||
let token = self.next_token();
|
let token = self.next_token();
|
||||||
let addr =
|
let addr = crate::socket::StdSocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
|
||||||
crate::socket::StdSocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
|
|
||||||
self.factories.push(StreamNewService::create(
|
self.factories.push(StreamNewService::create(
|
||||||
name.as_ref().to_string(),
|
name.as_ref().to_string(),
|
||||||
token,
|
token,
|
||||||
|
@ -18,13 +18,12 @@ mod test_server;
|
|||||||
mod waker_queue;
|
mod waker_queue;
|
||||||
mod worker;
|
mod worker;
|
||||||
|
|
||||||
pub use self::builder::ServerBuilder;
|
|
||||||
pub use self::handle::ServerHandle;
|
|
||||||
pub use self::server::Server;
|
|
||||||
pub use self::service::ServerServiceFactory;
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use self::socket::FromStream;
|
pub use self::socket::FromStream;
|
||||||
pub use self::test_server::TestServer;
|
pub use self::{
|
||||||
|
builder::ServerBuilder, handle::ServerHandle, server::Server, service::ServerServiceFactory,
|
||||||
|
test_server::TestServer,
|
||||||
|
};
|
||||||
|
|
||||||
/// Start server building process
|
/// Start server building process
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -78,7 +78,7 @@ where
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
error!("can not convert to an async TCP stream: {}", err);
|
error!("can not convert to an async TCP stream: {err}");
|
||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -8,8 +8,7 @@ pub(crate) use mio::net::TcpListener as MioTcpListener;
|
|||||||
use mio::{event::Source, Interest, Registry, Token};
|
use mio::{event::Source, Interest, Registry, Token};
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub(crate) use {
|
pub(crate) use {
|
||||||
mio::net::UnixListener as MioUnixListener,
|
mio::net::UnixListener as MioUnixListener, std::os::unix::net::UnixListener as StdUnixListener,
|
||||||
std::os::unix::net::UnixListener as StdUnixListener,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) enum MioListener {
|
pub(crate) enum MioListener {
|
||||||
@ -105,7 +104,7 @@ impl fmt::Debug for MioListener {
|
|||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match *self {
|
match *self {
|
||||||
MioListener::Tcp(ref lst) => write!(f, "{:?}", lst),
|
MioListener::Tcp(ref lst) => write!(f, "{:?}", lst),
|
||||||
#[cfg(all(unix))]
|
#[cfg(unix)]
|
||||||
MioListener::Uds(ref lst) => write!(f, "{:?}", lst),
|
MioListener::Uds(ref lst) => write!(f, "{:?}", lst),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -625,8 +625,8 @@ impl Future for ServerWorker {
|
|||||||
let factory_id = restart.factory_id;
|
let factory_id = restart.factory_id;
|
||||||
let token = restart.token;
|
let token = restart.token;
|
||||||
|
|
||||||
let (token_new, service) = ready!(restart.fut.as_mut().poll(cx))
|
let (token_new, service) =
|
||||||
.unwrap_or_else(|_| {
|
ready!(restart.fut.as_mut().poll(cx)).unwrap_or_else(|_| {
|
||||||
panic!(
|
panic!(
|
||||||
"Can not restart {:?} service",
|
"Can not restart {:?} service",
|
||||||
this.factories[factory_id].name(token)
|
this.factories[factory_id].name(token)
|
||||||
@ -697,7 +697,10 @@ impl Future for ServerWorker {
|
|||||||
match ready!(this.conn_rx.poll_recv(cx)) {
|
match ready!(this.conn_rx.poll_recv(cx)) {
|
||||||
Some(msg) => {
|
Some(msg) => {
|
||||||
let guard = this.counter.guard();
|
let guard = this.counter.guard();
|
||||||
let _ = this.services[msg.token].service.call((guard, msg.io));
|
let _ = this.services[msg.token]
|
||||||
|
.service
|
||||||
|
.call((guard, msg.io))
|
||||||
|
.into_inner();
|
||||||
}
|
}
|
||||||
None => return Poll::Ready(()),
|
None => return Poll::Ready(()),
|
||||||
};
|
};
|
||||||
@ -706,9 +709,7 @@ impl Future for ServerWorker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wrap_worker_services(
|
fn wrap_worker_services(services: Vec<(usize, usize, BoxedServerService)>) -> Vec<WorkerService> {
|
||||||
services: Vec<(usize, usize, BoxedServerService)>,
|
|
||||||
) -> Vec<WorkerService> {
|
|
||||||
services
|
services
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.fold(Vec::new(), |mut services, (idx, token, service)| {
|
.fold(Vec::new(), |mut services, (idx, token, service)| {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased - 2023-xx-xx
|
## Unreleased - 2023-xx-xx
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.60.
|
- Minimum supported Rust version (MSRV) is now 1.65.
|
||||||
|
|
||||||
## 2.0.2 - 2021-12-18
|
## 2.0.2 - 2021-12-18
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ keywords = ["network", "framework", "async", "futures", "service"]
|
|||||||
categories = ["network-programming", "asynchronous", "no-std"]
|
categories = ["network-programming", "asynchronous", "no-std"]
|
||||||
repository = "https://github.com/actix/actix-net"
|
repository = "https://github.com/actix/actix-net"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition.workspace = true
|
||||||
rust-version = "1.60"
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures-core = { version = "0.3.17", default-features = false }
|
futures-core = { version = "0.3.17", default-features = false }
|
||||||
|
@ -121,12 +121,7 @@ pub struct AndThenServiceFactory<A, B, Req>
|
|||||||
where
|
where
|
||||||
A: ServiceFactory<Req>,
|
A: ServiceFactory<Req>,
|
||||||
A::Config: Clone,
|
A::Config: Clone,
|
||||||
B: ServiceFactory<
|
B: ServiceFactory<A::Response, Config = A::Config, Error = A::Error, InitError = A::InitError>,
|
||||||
A::Response,
|
|
||||||
Config = A::Config,
|
|
||||||
Error = A::Error,
|
|
||||||
InitError = A::InitError,
|
|
||||||
>,
|
|
||||||
{
|
{
|
||||||
inner: Rc<(A, B)>,
|
inner: Rc<(A, B)>,
|
||||||
_phantom: PhantomData<Req>,
|
_phantom: PhantomData<Req>,
|
||||||
@ -136,12 +131,7 @@ impl<A, B, Req> AndThenServiceFactory<A, B, Req>
|
|||||||
where
|
where
|
||||||
A: ServiceFactory<Req>,
|
A: ServiceFactory<Req>,
|
||||||
A::Config: Clone,
|
A::Config: Clone,
|
||||||
B: ServiceFactory<
|
B: ServiceFactory<A::Response, Config = A::Config, Error = A::Error, InitError = A::InitError>,
|
||||||
A::Response,
|
|
||||||
Config = A::Config,
|
|
||||||
Error = A::Error,
|
|
||||||
InitError = A::InitError,
|
|
||||||
>,
|
|
||||||
{
|
{
|
||||||
/// Create new `AndThenFactory` combinator
|
/// Create new `AndThenFactory` combinator
|
||||||
pub(crate) fn new(a: A, b: B) -> Self {
|
pub(crate) fn new(a: A, b: B) -> Self {
|
||||||
@ -156,12 +146,7 @@ impl<A, B, Req> ServiceFactory<Req> for AndThenServiceFactory<A, B, Req>
|
|||||||
where
|
where
|
||||||
A: ServiceFactory<Req>,
|
A: ServiceFactory<Req>,
|
||||||
A::Config: Clone,
|
A::Config: Clone,
|
||||||
B: ServiceFactory<
|
B: ServiceFactory<A::Response, Config = A::Config, Error = A::Error, InitError = A::InitError>,
|
||||||
A::Response,
|
|
||||||
Config = A::Config,
|
|
||||||
Error = A::Error,
|
|
||||||
InitError = A::InitError,
|
|
||||||
>,
|
|
||||||
{
|
{
|
||||||
type Response = B::Response;
|
type Response = B::Response;
|
||||||
type Error = A::Error;
|
type Error = A::Error;
|
||||||
@ -184,12 +169,7 @@ impl<A, B, Req> Clone for AndThenServiceFactory<A, B, Req>
|
|||||||
where
|
where
|
||||||
A: ServiceFactory<Req>,
|
A: ServiceFactory<Req>,
|
||||||
A::Config: Clone,
|
A::Config: Clone,
|
||||||
B: ServiceFactory<
|
B: ServiceFactory<A::Response, Config = A::Config, Error = A::Error, InitError = A::InitError>,
|
||||||
A::Response,
|
|
||||||
Config = A::Config,
|
|
||||||
Error = A::Error,
|
|
||||||
InitError = A::InitError,
|
|
||||||
>,
|
|
||||||
{
|
{
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -334,9 +314,8 @@ mod tests {
|
|||||||
async fn test_new_service() {
|
async fn test_new_service() {
|
||||||
let cnt = Rc::new(Cell::new(0));
|
let cnt = Rc::new(Cell::new(0));
|
||||||
let cnt2 = cnt.clone();
|
let cnt2 = cnt.clone();
|
||||||
let new_srv =
|
let new_srv = pipeline_factory(fn_factory(move || ready(Ok::<_, ()>(Srv1(cnt2.clone())))))
|
||||||
pipeline_factory(fn_factory(move || ready(Ok::<_, ()>(Srv1(cnt2.clone())))))
|
.and_then(move || ready(Ok(Srv2(cnt.clone()))));
|
||||||
.and_then(move || ready(Ok(Srv2(cnt.clone()))));
|
|
||||||
|
|
||||||
let srv = new_srv.new_service(()).await.unwrap();
|
let srv = new_srv.new_service(()).await.unwrap();
|
||||||
let res = srv.call("srv1").await;
|
let res = srv.call("srv1").await;
|
||||||
|
@ -140,8 +140,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<SF, F, Fut, Req, In, Res, Err> ServiceFactory<Req>
|
impl<SF, F, Fut, Req, In, Res, Err> ServiceFactory<Req> for ApplyFactory<SF, F, Req, In, Res, Err>
|
||||||
for ApplyFactory<SF, F, Req, In, Res, Err>
|
|
||||||
where
|
where
|
||||||
SF: ServiceFactory<In, Error = Err>,
|
SF: ServiceFactory<In, Error = Err>,
|
||||||
F: Fn(Req, &SF::Service) -> Fut + Clone,
|
F: Fn(Req, &SF::Service) -> Fut + Clone,
|
||||||
|
@ -198,8 +198,7 @@ pin_project! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<SF, Req, F, Cfg, Fut, S> Future
|
impl<SF, Req, F, Cfg, Fut, S> Future for ApplyConfigServiceFactoryResponse<SF, Req, F, Cfg, Fut, S>
|
||||||
for ApplyConfigServiceFactoryResponse<SF, Req, F, Cfg, Fut, S>
|
|
||||||
where
|
where
|
||||||
SF: ServiceFactory<Req, Config = ()>,
|
SF: ServiceFactory<Req, Config = ()>,
|
||||||
SF::InitError: From<SF::Error>,
|
SF::InitError: From<SF::Error>,
|
||||||
|
@ -91,8 +91,7 @@ type Inner<C, Req, Res, Err, InitErr> = Box<
|
|||||||
>,
|
>,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
impl<C, Req, Res, Err, InitErr> ServiceFactory<Req>
|
impl<C, Req, Res, Err, InitErr> ServiceFactory<Req> for BoxServiceFactory<C, Req, Res, Err, InitErr>
|
||||||
for BoxServiceFactory<C, Req, Res, Err, InitErr>
|
|
||||||
where
|
where
|
||||||
Req: 'static,
|
Req: 'static,
|
||||||
Res: 'static,
|
Res: 'static,
|
||||||
|
@ -3,9 +3,7 @@ use core::{future::Future, marker::PhantomData};
|
|||||||
use crate::{ok, IntoService, IntoServiceFactory, Ready, Service, ServiceFactory};
|
use crate::{ok, IntoService, IntoServiceFactory, Ready, Service, ServiceFactory};
|
||||||
|
|
||||||
/// Create `ServiceFactory` for function that can act as a `Service`
|
/// Create `ServiceFactory` for function that can act as a `Service`
|
||||||
pub fn fn_service<F, Fut, Req, Res, Err, Cfg>(
|
pub fn fn_service<F, Fut, Req, Res, Err, Cfg>(f: F) -> FnServiceFactory<F, Fut, Req, Res, Err, Cfg>
|
||||||
f: F,
|
|
||||||
) -> FnServiceFactory<F, Fut, Req, Res, Err, Cfg>
|
|
||||||
where
|
where
|
||||||
F: Fn(Req) -> Fut + Clone,
|
F: Fn(Req) -> Fut + Clone,
|
||||||
Fut: Future<Output = Result<Res, Err>>,
|
Fut: Future<Output = Result<Res, Err>>,
|
||||||
@ -48,9 +46,7 @@ where
|
|||||||
/// Ok(())
|
/// Ok(())
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn fn_factory<F, Cfg, Srv, Req, Fut, Err>(
|
pub fn fn_factory<F, Cfg, Srv, Req, Fut, Err>(f: F) -> FnServiceNoConfig<F, Cfg, Srv, Req, Fut, Err>
|
||||||
f: F,
|
|
||||||
) -> FnServiceNoConfig<F, Cfg, Srv, Req, Fut, Err>
|
|
||||||
where
|
where
|
||||||
F: Fn() -> Fut,
|
F: Fn() -> Fut,
|
||||||
Fut: Future<Output = Result<Srv, Err>>,
|
Fut: Future<Output = Result<Srv, Err>>,
|
||||||
@ -265,8 +261,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F, Fut, Cfg, Srv, Req, Err> ServiceFactory<Req>
|
impl<F, Fut, Cfg, Srv, Req, Err> ServiceFactory<Req> for FnServiceConfig<F, Fut, Cfg, Srv, Req, Err>
|
||||||
for FnServiceConfig<F, Fut, Cfg, Srv, Req, Err>
|
|
||||||
where
|
where
|
||||||
F: Fn(Cfg) -> Fut,
|
F: Fn(Cfg) -> Fut,
|
||||||
Fut: Future<Output = Result<Srv, Err>>,
|
Fut: Future<Output = Result<Srv, Err>>,
|
||||||
@ -404,9 +399,8 @@ mod tests {
|
|||||||
ok::<_, Rc<u8>>(fn_service(|_: Rc<u8>| ok::<_, Rc<u8>>(Rc::new(0u8))))
|
ok::<_, Rc<u8>>(fn_service(|_: Rc<u8>| ok::<_, Rc<u8>>(Rc::new(0u8))))
|
||||||
});
|
});
|
||||||
|
|
||||||
let fac_2 = fn_factory(|| {
|
let fac_2 =
|
||||||
ok::<_, Rc<u8>>(fn_service(|_: Rc<u8>| ok::<_, Rc<u8>>(Rc::new(0u8))))
|
fn_factory(|| ok::<_, Rc<u8>>(fn_service(|_: Rc<u8>| ok::<_, Rc<u8>>(Rc::new(0u8)))));
|
||||||
});
|
|
||||||
|
|
||||||
fn is_send<T: Send + Sync + Clone>(_: &T) {}
|
fn is_send<T: Send + Sync + Clone>(_: &T) {}
|
||||||
|
|
||||||
|
@ -33,14 +33,16 @@ mod then;
|
|||||||
mod transform;
|
mod transform;
|
||||||
mod transform_err;
|
mod transform_err;
|
||||||
|
|
||||||
pub use self::apply::{apply_fn, apply_fn_factory};
|
|
||||||
pub use self::apply_cfg::{apply_cfg, apply_cfg_factory};
|
|
||||||
pub use self::ext::{ServiceExt, ServiceFactoryExt, TransformExt};
|
|
||||||
pub use self::fn_service::{fn_factory, fn_factory_with_config, fn_service};
|
|
||||||
pub use self::map_config::{map_config, unit_config};
|
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use self::ready::{err, ok, ready, Ready};
|
use self::ready::{err, ok, ready, Ready};
|
||||||
pub use self::transform::{apply, ApplyTransform, Transform};
|
pub use self::{
|
||||||
|
apply::{apply_fn, apply_fn_factory},
|
||||||
|
apply_cfg::{apply_cfg, apply_cfg_factory},
|
||||||
|
ext::{ServiceExt, ServiceFactoryExt, TransformExt},
|
||||||
|
fn_service::{fn_factory, fn_factory_with_config, fn_service},
|
||||||
|
map_config::{map_config, unit_config},
|
||||||
|
transform::{apply, ApplyTransform, Transform},
|
||||||
|
};
|
||||||
|
|
||||||
/// An asynchronous operation from `Request` to a `Response`.
|
/// An asynchronous operation from `Request` to a `Response`.
|
||||||
///
|
///
|
||||||
|
@ -206,8 +206,7 @@ mod tests {
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{
|
use crate::{
|
||||||
err, ok, IntoServiceFactory, Ready, Service, ServiceExt, ServiceFactory,
|
err, ok, IntoServiceFactory, Ready, Service, ServiceExt, ServiceFactory, ServiceFactoryExt,
|
||||||
ServiceFactoryExt,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Srv;
|
struct Srv;
|
||||||
|
@ -6,12 +6,14 @@ use core::{
|
|||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::and_then::{AndThenService, AndThenServiceFactory};
|
use crate::{
|
||||||
use crate::map::{Map, MapServiceFactory};
|
and_then::{AndThenService, AndThenServiceFactory},
|
||||||
use crate::map_err::{MapErr, MapErrServiceFactory};
|
map::{Map, MapServiceFactory},
|
||||||
use crate::map_init_err::MapInitErr;
|
map_err::{MapErr, MapErrServiceFactory},
|
||||||
use crate::then::{ThenService, ThenServiceFactory};
|
map_init_err::MapInitErr,
|
||||||
use crate::{IntoService, IntoServiceFactory, Service, ServiceFactory};
|
then::{ThenService, ThenServiceFactory},
|
||||||
|
IntoService, IntoServiceFactory, Service, ServiceFactory,
|
||||||
|
};
|
||||||
|
|
||||||
/// Construct new pipeline with one service in pipeline chain.
|
/// Construct new pipeline with one service in pipeline chain.
|
||||||
pub(crate) fn pipeline<I, S, Req>(service: I) -> Pipeline<S, Req>
|
pub(crate) fn pipeline<I, S, Req>(service: I) -> Pipeline<S, Req>
|
||||||
@ -252,10 +254,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Map this service's error to a different error, returning a new service.
|
/// Map this service's error to a different error, returning a new service.
|
||||||
pub fn map_err<F, E>(
|
pub fn map_err<F, E>(self, f: F) -> PipelineFactory<MapErrServiceFactory<SF, Req, F, E>, Req>
|
||||||
self,
|
|
||||||
f: F,
|
|
||||||
) -> PipelineFactory<MapErrServiceFactory<SF, Req, F, E>, Req>
|
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
F: Fn(SF::Error) -> E + Clone,
|
F: Fn(SF::Error) -> E + Clone,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased - 2023-xx-xx
|
## Unreleased - 2023-xx-xx
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.60.
|
- Minimum supported Rust version (MSRV) is now 1.65.
|
||||||
|
|
||||||
## 3.0.4 - 2022-03-15
|
## 3.0.4 - 2022-03-15
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ keywords = ["network", "tls", "ssl", "async", "transport"]
|
|||||||
repository = "https://github.com/actix/actix-net.git"
|
repository = "https://github.com/actix/actix-net.git"
|
||||||
categories = ["network-programming", "asynchronous", "cryptography"]
|
categories = ["network-programming", "asynchronous", "cryptography"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition.workspace = true
|
||||||
rust-version = "1.60"
|
rust-version.workspace = true
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
@ -56,6 +56,25 @@ pub enum TlsError<TlsErr, SvcErr> {
|
|||||||
Service(SvcErr),
|
Service(SvcErr),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<TlsErr> TlsError<TlsErr, Infallible> {
|
||||||
|
/// Casts the infallible service error type returned from acceptors into caller's type.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
/// ```
|
||||||
|
/// # use std::convert::Infallible;
|
||||||
|
/// # use actix_tls::accept::TlsError;
|
||||||
|
/// let a: TlsError<u32, Infallible> = TlsError::Tls(42);
|
||||||
|
/// let _b: TlsError<u32, u64> = a.into_service_error();
|
||||||
|
/// ```
|
||||||
|
pub fn into_service_error<SvcErr>(self) -> TlsError<TlsErr, SvcErr> {
|
||||||
|
match self {
|
||||||
|
Self::Timeout => TlsError::Timeout,
|
||||||
|
Self::Tls(err) => TlsError::Tls(err),
|
||||||
|
Self::Service(err) => match err {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<TlsErr, SvcErr> fmt::Display for TlsError<TlsErr, SvcErr> {
|
impl<TlsErr, SvcErr> fmt::Display for TlsError<TlsErr, SvcErr> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
@ -80,25 +99,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<TlsErr> TlsError<TlsErr, Infallible> {
|
|
||||||
/// Casts the infallible service error type returned from acceptors into caller's type.
|
|
||||||
///
|
|
||||||
/// # Examples
|
|
||||||
/// ```
|
|
||||||
/// # use std::convert::Infallible;
|
|
||||||
/// # use actix_tls::accept::TlsError;
|
|
||||||
/// let a: TlsError<u32, Infallible> = TlsError::Tls(42);
|
|
||||||
/// let _b: TlsError<u32, u64> = a.into_service_error();
|
|
||||||
/// ```
|
|
||||||
pub fn into_service_error<SvcErr>(self) -> TlsError<TlsErr, SvcErr> {
|
|
||||||
match self {
|
|
||||||
Self::Timeout => TlsError::Timeout,
|
|
||||||
Self::Tls(err) => TlsError::Tls(err),
|
|
||||||
Self::Service(err) => match err {},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -23,8 +23,7 @@ use actix_utils::{
|
|||||||
};
|
};
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||||
use tokio_rustls::rustls::ServerConfig;
|
use tokio_rustls::{rustls::ServerConfig, Accept, TlsAcceptor};
|
||||||
use tokio_rustls::{Accept, TlsAcceptor};
|
|
||||||
|
|
||||||
use super::{TlsError, DEFAULT_TLS_HANDSHAKE_TIMEOUT, MAX_CONN_COUNTER};
|
use super::{TlsError, DEFAULT_TLS_HANDSHAKE_TIMEOUT, MAX_CONN_COUNTER};
|
||||||
|
|
||||||
|
@ -33,10 +33,12 @@ pub mod rustls;
|
|||||||
#[cfg(feature = "native-tls")]
|
#[cfg(feature = "native-tls")]
|
||||||
pub mod native_tls;
|
pub mod native_tls;
|
||||||
|
|
||||||
pub use self::connection::Connection;
|
pub use self::{
|
||||||
pub use self::connector::{Connector, ConnectorService};
|
connection::Connection,
|
||||||
pub use self::error::ConnectError;
|
connector::{Connector, ConnectorService},
|
||||||
pub use self::host::Host;
|
error::ConnectError,
|
||||||
pub use self::info::ConnectInfo;
|
host::Host,
|
||||||
pub use self::resolve::Resolve;
|
info::ConnectInfo,
|
||||||
pub use self::resolver::{Resolver, ResolverService};
|
resolve::Resolve,
|
||||||
|
resolver::{Resolver, ResolverService},
|
||||||
|
};
|
||||||
|
@ -19,8 +19,7 @@ use crate::connect::{Connection, Host};
|
|||||||
pub mod reexports {
|
pub mod reexports {
|
||||||
//! Re-exports from `native-tls` and `tokio-native-tls` that are useful for connectors.
|
//! Re-exports from `native-tls` and `tokio-native-tls` that are useful for connectors.
|
||||||
|
|
||||||
pub use tokio_native_tls::native_tls::TlsConnector;
|
pub use tokio_native_tls::{native_tls::TlsConnector, TlsStream as AsyncTlsStream};
|
||||||
pub use tokio_native_tls::TlsStream as AsyncTlsStream;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Connector service and factory using `native-tls`.
|
/// Connector service and factory using `native-tls`.
|
||||||
|
@ -22,9 +22,7 @@ use crate::connect::{Connection, Host};
|
|||||||
pub mod reexports {
|
pub mod reexports {
|
||||||
//! Re-exports from `openssl` and `tokio-openssl` that are useful for connectors.
|
//! Re-exports from `openssl` and `tokio-openssl` that are useful for connectors.
|
||||||
|
|
||||||
pub use openssl::ssl::{
|
pub use openssl::ssl::{Error, HandshakeError, SslConnector, SslConnectorBuilder, SslMethod};
|
||||||
Error, HandshakeError, SslConnector, SslConnectorBuilder, SslMethod,
|
|
||||||
};
|
|
||||||
pub use tokio_openssl::SslStream as AsyncSslStream;
|
pub use tokio_openssl::SslStream as AsyncSslStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,11 @@ use actix_rt::net::ActixStream;
|
|||||||
use actix_service::{Service, ServiceFactory};
|
use actix_service::{Service, ServiceFactory};
|
||||||
use actix_utils::future::{ok, Ready};
|
use actix_utils::future::{ok, Ready};
|
||||||
use futures_core::ready;
|
use futures_core::ready;
|
||||||
use tokio_rustls::rustls::{client::ServerName, OwnedTrustAnchor, RootCertStore};
|
use tokio_rustls::{
|
||||||
use tokio_rustls::{client::TlsStream as AsyncTlsStream, rustls::ClientConfig};
|
client::TlsStream as AsyncTlsStream,
|
||||||
use tokio_rustls::{Connect as RustlsConnect, TlsConnector as RustlsTlsConnector};
|
rustls::{client::ServerName, ClientConfig, OwnedTrustAnchor, RootCertStore},
|
||||||
|
Connect as RustlsConnect, TlsConnector as RustlsTlsConnector,
|
||||||
|
};
|
||||||
use tracing::trace;
|
use tracing::trace;
|
||||||
use webpki_roots::TLS_SERVER_ROOTS;
|
use webpki_roots::TLS_SERVER_ROOTS;
|
||||||
|
|
||||||
@ -26,8 +28,7 @@ use crate::connect::{Connection, Host};
|
|||||||
pub mod reexports {
|
pub mod reexports {
|
||||||
//! Re-exports from `rustls` and `webpki_roots` that are useful for connectors.
|
//! Re-exports from `rustls` and `webpki_roots` that are useful for connectors.
|
||||||
|
|
||||||
pub use tokio_rustls::client::TlsStream as AsyncTlsStream;
|
pub use tokio_rustls::{client::TlsStream as AsyncTlsStream, rustls::ClientConfig};
|
||||||
pub use tokio_rustls::rustls::ClientConfig;
|
|
||||||
pub use webpki_roots::TLS_SERVER_ROOTS;
|
pub use webpki_roots::TLS_SERVER_ROOTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,11 +17,9 @@ use actix_utils::future::ok;
|
|||||||
use tokio_rustls::rustls::{Certificate, ClientConfig, RootCertStore, ServerName};
|
use tokio_rustls::rustls::{Certificate, ClientConfig, RootCertStore, ServerName};
|
||||||
|
|
||||||
fn new_cert_and_key() -> (String, String) {
|
fn new_cert_and_key() -> (String, String) {
|
||||||
let cert = rcgen::generate_simple_self_signed(vec![
|
let cert =
|
||||||
"127.0.0.1".to_owned(),
|
rcgen::generate_simple_self_signed(vec!["127.0.0.1".to_owned(), "localhost".to_owned()])
|
||||||
"localhost".to_owned(),
|
.unwrap();
|
||||||
])
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let key = cert.serialize_private_key_pem();
|
let key = cert.serialize_private_key_pem();
|
||||||
let cert = cert.serialize_pem().unwrap();
|
let cert = cert.serialize_pem().unwrap();
|
||||||
|
@ -14,19 +14,19 @@ use std::io::{BufReader, Write};
|
|||||||
use actix_rt::net::TcpStream;
|
use actix_rt::net::TcpStream;
|
||||||
use actix_server::TestServer;
|
use actix_server::TestServer;
|
||||||
use actix_service::ServiceFactoryExt as _;
|
use actix_service::ServiceFactoryExt as _;
|
||||||
use actix_tls::accept::rustls::{Acceptor, TlsStream};
|
use actix_tls::{
|
||||||
use actix_tls::connect::openssl::reexports::SslConnector;
|
accept::rustls::{Acceptor, TlsStream},
|
||||||
|
connect::openssl::reexports::SslConnector,
|
||||||
|
};
|
||||||
use actix_utils::future::ok;
|
use actix_utils::future::ok;
|
||||||
use rustls_pemfile::{certs, pkcs8_private_keys};
|
use rustls_pemfile::{certs, pkcs8_private_keys};
|
||||||
use tls_openssl::ssl::SslVerifyMode;
|
use tls_openssl::ssl::SslVerifyMode;
|
||||||
use tokio_rustls::rustls::{self, Certificate, PrivateKey, ServerConfig};
|
use tokio_rustls::rustls::{self, Certificate, PrivateKey, ServerConfig};
|
||||||
|
|
||||||
fn new_cert_and_key() -> (String, String) {
|
fn new_cert_and_key() -> (String, String) {
|
||||||
let cert = rcgen::generate_simple_self_signed(vec![
|
let cert =
|
||||||
"127.0.0.1".to_owned(),
|
rcgen::generate_simple_self_signed(vec!["127.0.0.1".to_owned(), "localhost".to_owned()])
|
||||||
"localhost".to_owned(),
|
.unwrap();
|
||||||
])
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let key = cert.serialize_private_key_pem();
|
let key = cert.serialize_private_key_pem();
|
||||||
let cert = cert.serialize_pem().unwrap();
|
let cert = cert.serialize_pem().unwrap();
|
||||||
|
@ -51,8 +51,7 @@ async fn custom_resolver_connect() {
|
|||||||
|
|
||||||
use trust_dns_resolver::TokioAsyncResolver;
|
use trust_dns_resolver::TokioAsyncResolver;
|
||||||
|
|
||||||
let srv =
|
let srv = TestServer::start(|| fn_service(|_io: TcpStream| async { Ok::<_, io::Error>(()) }));
|
||||||
TestServer::start(|| fn_service(|_io: TcpStream| async { Ok::<_, io::Error>(()) }));
|
|
||||||
|
|
||||||
struct MyResolver {
|
struct MyResolver {
|
||||||
trust_dns: TokioAsyncResolver,
|
trust_dns: TokioAsyncResolver,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased - 2023-xx-xx
|
## Unreleased - 2023-xx-xx
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.60.
|
- Minimum supported Rust version (MSRV) is now 1.65.
|
||||||
|
|
||||||
## 0.1.0 - 2020-01-15
|
## 0.1.0 - 2020-01-15
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ repository = "https://github.com/actix/actix-net.git"
|
|||||||
documentation = "https://docs.rs/actix-tracing"
|
documentation = "https://docs.rs/actix-tracing"
|
||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition.workspace = true
|
||||||
rust-version = "1.60"
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-service = "2"
|
actix-service = "2"
|
||||||
|
@ -118,9 +118,11 @@ where
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use std::cell::RefCell;
|
use std::{
|
||||||
use std::collections::{BTreeMap, BTreeSet};
|
cell::RefCell,
|
||||||
use std::sync::{Arc, RwLock};
|
collections::{BTreeMap, BTreeSet},
|
||||||
|
sync::{Arc, RwLock},
|
||||||
|
};
|
||||||
|
|
||||||
use actix_service::{fn_factory, fn_service};
|
use actix_service::{fn_factory, fn_service};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased - 2023-xx-xx
|
## Unreleased - 2023-xx-xx
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.60.
|
- Minimum supported Rust version (MSRV) is now 1.65.
|
||||||
|
|
||||||
## 3.0.1 - 2022-10-21
|
## 3.0.1 - 2022-10-21
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ keywords = ["network", "framework", "async", "futures"]
|
|||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
repository = "https://github.com/actix/actix-net"
|
repository = "https://github.com/actix/actix-net"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition.workspace = true
|
||||||
rust-version = "1.60"
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
pin-project-lite = "0.2"
|
pin-project-lite = "0.2"
|
||||||
|
@ -4,6 +4,8 @@ mod either;
|
|||||||
mod poll_fn;
|
mod poll_fn;
|
||||||
mod ready;
|
mod ready;
|
||||||
|
|
||||||
pub use self::either::Either;
|
pub use self::{
|
||||||
pub use self::poll_fn::{poll_fn, PollFn};
|
either::Either,
|
||||||
pub use self::ready::{err, ok, ready, Ready};
|
poll_fn::{poll_fn, PollFn},
|
||||||
|
ready::{err, ok, ready, Ready},
|
||||||
|
};
|
||||||
|
@ -11,8 +11,8 @@ categories = ["no-std", "web-programming"]
|
|||||||
homepage = "https://actix.rs"
|
homepage = "https://actix.rs"
|
||||||
repository = "https://github.com/actix/actix-net.git"
|
repository = "https://github.com/actix/actix-net.git"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition.workspace = true
|
||||||
rust-version = "1.60"
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bytes = { version = "1.2", default-features = false }
|
bytes = { version = "1.2", default-features = false }
|
||||||
|
@ -253,8 +253,10 @@ impl fmt::Display for ByteString {
|
|||||||
mod serde {
|
mod serde {
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
|
|
||||||
use serde::de::{Deserialize, Deserializer};
|
use serde::{
|
||||||
use serde::ser::{Serialize, Serializer};
|
de::{Deserialize, Deserializer},
|
||||||
|
ser::{Serialize, Serializer},
|
||||||
|
};
|
||||||
|
|
||||||
use super::ByteString;
|
use super::ByteString;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased - 2023-xx-xx
|
## Unreleased - 2023-xx-xx
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.60.
|
- Minimum supported Rust version (MSRV) is now 1.65.
|
||||||
|
|
||||||
## 0.1.3 - 2022-05-03
|
## 0.1.3 - 2022-05-03
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ authors = [
|
|||||||
repository = "https://github.com/actix/actix-net.git"
|
repository = "https://github.com/actix/actix-net.git"
|
||||||
keywords = ["channel", "local", "futures"]
|
keywords = ["channel", "local", "futures"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition.workspace = true
|
||||||
rust-version = "1.60"
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures-core = "0.3.17"
|
futures-core = "0.3.17"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased - 2023-xx-xx
|
## Unreleased - 2023-xx-xx
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.60.
|
- Minimum supported Rust version (MSRV) is now 1.65.
|
||||||
|
|
||||||
## 0.1.3 - 2022-05-03
|
## 0.1.3 - 2022-05-03
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ repository = "https://github.com/actix/actix-net.git"
|
|||||||
keywords = ["waker", "local", "futures", "no-std"]
|
keywords = ["waker", "local", "futures", "no-std"]
|
||||||
categories = ["asynchronous", "no-std"]
|
categories = ["asynchronous", "no-std"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition.workspace = true
|
||||||
rust-version = "1.60"
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
max_width = 96
|
|
||||||
group_imports = "StdExternalCrate"
|
|
Loading…
x
Reference in New Issue
Block a user