Compare commits

..

No commits in common. "a031cdcc2770e8c927d0292a89b8c3c2da060dfc" and "0de42a2c322fd788b2fb603e6397181ceb6839e3" have entirely different histories.

23 changed files with 95 additions and 137 deletions

View File

@ -1,8 +1,3 @@
version: "0.2" version: "0.2"
words: words:
- actix - actix
- addrs
- httparse
- msrv
- rustup
- zstd

View File

@ -1,11 +1,10 @@
version: 2 version: 2
updates: updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
- package-ecosystem: cargo - package-ecosystem: cargo
directory: / directory: /
schedule: schedule:
interval: weekly interval: weekly
versioning-strategy: lockfile-only - package-ecosystem: github-actions
directory: /
schedule:
interval: weekly

View File

@ -44,12 +44,12 @@ jobs:
echo "RUSTFLAGS=-C target-feature=+crt-static" >> $GITHUB_ENV echo "RUSTFLAGS=-C target-feature=+crt-static" >> $GITHUB_ENV
- name: Install Rust (${{ matrix.version.name }}) - name: Install Rust (${{ matrix.version.name }})
uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
with: with:
toolchain: ${{ matrix.version.version }} toolchain: ${{ matrix.version.version }}
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean - name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
uses: taiki-e/install-action@v2.50.10 uses: taiki-e/install-action@v2.49.45
with: with:
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
@ -80,10 +80,10 @@ jobs:
uses: rui314/setup-mold@v1 uses: rui314/setup-mold@v1
- name: Install Rust - name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
- name: Install just, cargo-hack - name: Install just, cargo-hack
uses: taiki-e/install-action@v2.50.10 uses: taiki-e/install-action@v2.49.45
with: with:
tool: just,cargo-hack tool: just,cargo-hack

View File

@ -59,12 +59,12 @@ jobs:
uses: rui314/setup-mold@v1 uses: rui314/setup-mold@v1
- name: Install Rust (${{ matrix.version.name }}) - name: Install Rust (${{ matrix.version.name }})
uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
with: with:
toolchain: ${{ matrix.version.version }} toolchain: ${{ matrix.version.version }}
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean - name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
uses: taiki-e/install-action@v2.50.10 uses: taiki-e/install-action@v2.49.45
with: with:
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
@ -92,7 +92,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust - name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
with: with:
toolchain: nightly toolchain: nightly
@ -108,12 +108,12 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust (nightly) - name: Install Rust (nightly)
uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
with: with:
toolchain: nightly toolchain: nightly
- name: Install just - name: Install just
uses: taiki-e/install-action@v2.50.10 uses: taiki-e/install-action@v2.49.45
with: with:
tool: just tool: just

View File

@ -18,13 +18,13 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust (nightly) - name: Install Rust (nightly)
uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
with: with:
toolchain: nightly toolchain: nightly
components: llvm-tools components: llvm-tools
- name: Install just, cargo-llvm-cov, cargo-nextest - name: Install just, cargo-llvm-cov, cargo-nextest
uses: taiki-e/install-action@v2.50.10 uses: taiki-e/install-action@v2.49.45
with: with:
tool: just,cargo-llvm-cov,cargo-nextest tool: just,cargo-llvm-cov,cargo-nextest
@ -32,7 +32,7 @@ jobs:
run: just test-coverage-codecov run: just test-coverage-codecov
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: codecov/codecov-action@v5.4.2 uses: codecov/codecov-action@v5.4.0
with: with:
files: codecov.json files: codecov.json
fail_ci_if_error: true fail_ci_if_error: true

View File

@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust (nightly) - name: Install Rust (nightly)
uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
with: with:
toolchain: nightly toolchain: nightly
components: rustfmt components: rustfmt
@ -36,7 +36,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust - name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
with: with:
components: clippy components: clippy
@ -55,7 +55,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust (nightly) - name: Install Rust (nightly)
uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
with: with:
toolchain: nightly toolchain: nightly
components: rust-docs components: rust-docs
@ -72,12 +72,12 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust (${{ vars.RUST_VERSION_EXTERNAL_TYPES }}) - name: Install Rust (${{ vars.RUST_VERSION_EXTERNAL_TYPES }})
uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
with: with:
toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }} toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
- name: Install just - name: Install just
uses: taiki-e/install-action@v2.50.10 uses: taiki-e/install-action@v2.49.45
with: with:
tool: just tool: just

46
Cargo.lock generated
View File

@ -109,7 +109,7 @@ dependencies = [
"openssl", "openssl",
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rand 0.9.1", "rand 0.9.0",
"rcgen", "rcgen",
"regex", "regex",
"rustls 0.23.25", "rustls 0.23.25",
@ -185,7 +185,7 @@ dependencies = [
"memchr", "memchr",
"mime", "mime",
"multer", "multer",
"rand 0.9.1", "rand 0.9.0",
"serde", "serde",
"serde_json", "serde_json",
"serde_plain", "serde_plain",
@ -251,9 +251,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-server" name = "actix-server"
version = "2.6.0" version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a65064ea4a457eaf07f2fba30b4c695bf43b721790e9530d26cb6f9019ff7502" checksum = "6398974fd4284f4768af07965701efbbb5fdc0616bff20cade1bb14b77675e24"
dependencies = [ dependencies = [
"actix-rt", "actix-rt",
"actix-service", "actix-service",
@ -383,7 +383,7 @@ dependencies = [
"once_cell", "once_cell",
"openssl", "openssl",
"pin-project-lite", "pin-project-lite",
"rand 0.9.1", "rand 0.9.0",
"rcgen", "rcgen",
"regex", "regex",
"regex-lite", "regex-lite",
@ -397,7 +397,6 @@ dependencies = [
"static_assertions", "static_assertions",
"time", "time",
"tokio", "tokio",
"tokio-util",
"tracing", "tracing",
"url", "url",
"zstd", "zstd",
@ -651,7 +650,7 @@ dependencies = [
"openssl", "openssl",
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rand 0.9.1", "rand 0.9.0",
"rcgen", "rcgen",
"rustls 0.20.9", "rustls 0.20.9",
"rustls 0.21.12", "rustls 0.21.12",
@ -763,9 +762,9 @@ dependencies = [
[[package]] [[package]]
name = "brotli" name = "brotli"
version = "8.0.0" version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf19e729cdbd51af9a397fb9ef8ac8378007b797f8273cfbfdf45dcaa316167b" checksum = "cc97b8f16f944bba54f0433f07e30be199b6dc2bd25937444bbad560bcea29bd"
dependencies = [ dependencies = [
"alloc-no-stdlib", "alloc-no-stdlib",
"alloc-stdlib", "alloc-stdlib",
@ -774,9 +773,9 @@ dependencies = [
[[package]] [[package]]
name = "brotli-decompressor" name = "brotli-decompressor"
version = "5.0.0" version = "4.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03" checksum = "74fa05ad7d803d413eb8380983b092cbbaf9a85f151b871360e7b00cd7060b37"
dependencies = [ dependencies = [
"alloc-no-stdlib", "alloc-no-stdlib",
"alloc-stdlib", "alloc-stdlib",
@ -1212,9 +1211,9 @@ dependencies = [
[[package]] [[package]]
name = "divan" name = "divan"
version = "0.1.21" version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a405457ec78b8fe08b0e32b4a3570ab5dff6dd16eb9e76a5ee0a9d9cbd898933" checksum = "009c56317fe2bd3b5eebe3aa888828c62ed1b085d26c1ef2079a60369795765e"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"clap", "clap",
@ -1226,9 +1225,9 @@ dependencies = [
[[package]] [[package]]
name = "divan-macros" name = "divan-macros"
version = "0.1.21" version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9556bc800956545d6420a640173e5ba7dfa82f38d3ea5a167eb555bc69ac3323" checksum = "0f4de9827ae754db91aedec0277381f5a2d8e2f801564c8d774acfe1ab1b045e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2362,9 +2361,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.95" version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -2397,12 +2396,13 @@ dependencies = [
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.9.1" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94"
dependencies = [ dependencies = [
"rand_chacha 0.9.0", "rand_chacha 0.9.0",
"rand_core 0.9.3", "rand_core 0.9.3",
"zerocopy",
] ]
[[package]] [[package]]
@ -3103,9 +3103,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.45.0" version = "1.44.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2513ca694ef9ede0fb23fe71a4ee4107cb102b9dc1930f6d0fd77aae068ae165" checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bytes", "bytes",
@ -3211,9 +3211,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-util" name = "tokio-util"
version = "0.7.15" version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-core", "futures-core",

View File

@ -2,8 +2,6 @@
## Unreleased ## Unreleased
- Update `brotli` dependency to `8`.
## 3.10.0 ## 3.10.0
### Added ### Added

View File

@ -139,7 +139,7 @@ sha1 = { version = "0.10", optional = true }
actix-tls = { version = "3.4", default-features = false, optional = true } actix-tls = { version = "3.4", default-features = false, optional = true }
# compress-* # compress-*
brotli = { version = "8", optional = true } brotli = { version = "7", optional = true }
flate2 = { version = "1.0.13", optional = true } flate2 = { version = "1.0.13", optional = true }
zstd = { version = "0.13", optional = true } zstd = { version = "0.13", optional = true }

View File

@ -31,7 +31,7 @@ async fn main() -> io::Result<()> {
actix_rt::time::sleep(Duration::from_secs(1)).await; actix_rt::time::sleep(Duration::from_secs(1)).await;
yield Err(io::Error::other("abc")); yield Err(io::Error::new(io::ErrorKind::Other, "abc"));
}))) })))
}) })
.tcp() .tcp()

View File

@ -190,7 +190,7 @@ mod tests {
#[actix_rt::test] #[actix_rt::test]
async fn to_body_limit_error() { async fn to_body_limit_error() {
let err_stream = stream::once(async { Err(io::Error::other("")) }); let err_stream = stream::once(async { Err(io::Error::new(io::ErrorKind::Other, "")) });
let body = SizedStream::new(8, err_stream); let body = SizedStream::new(8, err_stream);
// not too big, but propagates error from body stream // not too big, but propagates error from body stream
assert!(to_bytes_limited(body, 10).await.unwrap().is_err()); assert!(to_bytes_limited(body, 10).await.unwrap().is_err());

View File

@ -100,7 +100,10 @@ where
loop { loop {
if let Some(ref mut fut) = this.fut { if let Some(ref mut fut) = this.fut {
let (chunk, decoder) = ready!(Pin::new(fut).poll(cx)).map_err(|_| { let (chunk, decoder) = ready!(Pin::new(fut).poll(cx)).map_err(|_| {
PayloadError::Io(io::Error::other("Blocking task was cancelled unexpectedly")) PayloadError::Io(io::Error::new(
io::ErrorKind::Other,
"Blocking task was cancelled unexpectedly",
))
})??; })??;
*this.decoder = Some(decoder); *this.decoder = Some(decoder);

View File

@ -183,7 +183,8 @@ where
if let Some(ref mut fut) = this.fut { if let Some(ref mut fut) = this.fut {
let mut encoder = ready!(Pin::new(fut).poll(cx)) let mut encoder = ready!(Pin::new(fut).poll(cx))
.map_err(|_| { .map_err(|_| {
EncoderError::Io(io::Error::other( EncoderError::Io(io::Error::new(
io::ErrorKind::Other,
"Blocking task was cancelled unexpectedly", "Blocking task was cancelled unexpectedly",
)) ))
})? })?

View File

@ -415,7 +415,7 @@ mod tests {
#[test] #[test]
fn test_as_response() { fn test_as_response() {
let orig = io::Error::other("other"); let orig = io::Error::new(io::ErrorKind::Other, "other");
let err: Error = ParseError::Io(orig).into(); let err: Error = ParseError::Io(orig).into();
assert_eq!( assert_eq!(
format!("{}", err), format!("{}", err),
@ -425,14 +425,14 @@ mod tests {
#[test] #[test]
fn test_error_display() { fn test_error_display() {
let orig = io::Error::other("other"); let orig = io::Error::new(io::ErrorKind::Other, "other");
let err = Error::new_io().with_cause(orig); let err = Error::new_io().with_cause(orig);
assert_eq!("connection error: other", err.to_string()); assert_eq!("connection error: other", err.to_string());
} }
#[test] #[test]
fn test_error_http_response() { fn test_error_http_response() {
let orig = io::Error::other("other"); let orig = io::Error::new(io::ErrorKind::Other, "other");
let err = Error::new_io().with_cause(orig); let err = Error::new_io().with_cause(orig);
let resp: Response<BoxBody> = err.into(); let resp: Response<BoxBody> = err.into();
assert_eq!(resp.status(), StatusCode::INTERNAL_SERVER_ERROR); assert_eq!(resp.status(), StatusCode::INTERNAL_SERVER_ERROR);
@ -440,7 +440,7 @@ mod tests {
#[test] #[test]
fn test_payload_error() { fn test_payload_error() {
let err: PayloadError = io::Error::other("ParseError").into(); let err: PayloadError = io::Error::new(io::ErrorKind::Other, "ParseError").into();
assert!(err.to_string().contains("ParseError")); assert!(err.to_string().contains("ParseError"));
let err = PayloadError::Incomplete(None); let err = PayloadError::Incomplete(None);
@ -475,7 +475,7 @@ mod tests {
#[test] #[test]
fn test_from() { fn test_from() {
from_and_cause!(io::Error::other("other") => ParseError::Io(..)); from_and_cause!(io::Error::new(io::ErrorKind::Other, "other") => ParseError::Io(..));
from!(httparse::Error::HeaderName => ParseError::Header); from!(httparse::Error::HeaderName => ParseError::Header);
from!(httparse::Error::HeaderName => ParseError::Header); from!(httparse::Error::HeaderName => ParseError::Header);
from!(httparse::Error::HeaderValue => ParseError::Header); from!(httparse::Error::HeaderValue => ParseError::Header);

View File

@ -310,10 +310,10 @@ impl MessageType for RequestHeadType {
Version::HTTP_11 => "HTTP/1.1", Version::HTTP_11 => "HTTP/1.1",
Version::HTTP_2 => "HTTP/2.0", Version::HTTP_2 => "HTTP/2.0",
Version::HTTP_3 => "HTTP/3.0", Version::HTTP_3 => "HTTP/3.0",
_ => return Err(io::Error::other("Unsupported version")), _ => return Err(io::Error::new(io::ErrorKind::Other, "unsupported version")),
} }
) )
.map_err(io::Error::other) .map_err(|err| io::Error::new(io::ErrorKind::Other, err))
} }
} }
@ -433,7 +433,7 @@ impl TransferEncoding {
buf.extend_from_slice(b"0\r\n\r\n"); buf.extend_from_slice(b"0\r\n\r\n");
} else { } else {
writeln!(helpers::MutWriter(buf), "{:X}\r", msg.len()) writeln!(helpers::MutWriter(buf), "{:X}\r", msg.len())
.map_err(io::Error::other)?; .map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
buf.reserve(msg.len() + 2); buf.reserve(msg.len() + 2);
buf.extend_from_slice(msg); buf.extend_from_slice(msg);

View File

@ -776,7 +776,10 @@ where
} }
Poll::Pending => break, Poll::Pending => break,
Poll::Ready(Some(Err(err))) => { Poll::Ready(Some(Err(err))) => {
return Poll::Ready(Some(Err(ProtocolError::Io(io::Error::other(err))))); return Poll::Ready(Some(Err(ProtocolError::Io(io::Error::new(
io::ErrorKind::Other,
format!("{err}"),
)))));
} }
} }
} }
@ -792,10 +795,11 @@ where
} }
Some(frm) => { Some(frm) => {
let msg = match frm { let msg = match frm {
Frame::Text(data) => Message::Text( Frame::Text(data) => {
ByteString::try_from(data) Message::Text(ByteString::try_from(data).map_err(|err| {
.map_err(|err| ProtocolError::Io(io::Error::other(err)))?, ProtocolError::Io(io::Error::new(io::ErrorKind::Other, err))
), })?)
}
Frame::Binary(data) => Message::Binary(data), Frame::Binary(data) => Message::Binary(data),
Frame::Ping(s) => Message::Ping(s), Frame::Ping(s) => Message::Ping(s),
Frame::Pong(s) => Message::Pong(s), Frame::Pong(s) => Message::Pong(s),

View File

@ -2,11 +2,6 @@
## Unreleased ## Unreleased
- Add `HttpServer::shutdown_signal()` method.
- Mark `HttpServer` as `#[must_use]`.
- Re-export `mime` dependency.
- Update `brotli` dependency to `8`.
## 4.10.2 ## 4.10.2
- No significant changes since `4.10.1`. - No significant changes since `4.10.1`.

View File

@ -132,7 +132,7 @@ compat-routing-macros-force-pub = ["actix-web-codegen?/compat-routing-macros-for
actix-codec = "0.5" actix-codec = "0.5"
actix-macros = { version = "0.2.3", optional = true } actix-macros = { version = "0.2.3", optional = true }
actix-rt = { version = "2.6", default-features = false } actix-rt = { version = "2.6", default-features = false }
actix-server = "2.6" actix-server = "2"
actix-service = "2" actix-service = "2"
actix-utils = "3" actix-utils = "3"
actix-tls = { version = "3.4", default-features = false, optional = true } actix-tls = { version = "3.4", default-features = false, optional = true }
@ -173,7 +173,7 @@ actix-files = "0.6"
actix-test = { version = "0.1", features = ["openssl", "rustls-0_23"] } actix-test = { version = "0.1", features = ["openssl", "rustls-0_23"] }
awc = { version = "3", features = ["openssl"] } awc = { version = "3", features = ["openssl"] }
brotli = "8" brotli = "7"
const-str = "0.5" const-str = "0.5"
core_affinity = "0.8" core_affinity = "0.8"
criterion = { version = "0.5", features = ["html_reports"] } criterion = { version = "0.5", features = ["html_reports"] }
@ -188,7 +188,6 @@ static_assertions = "1"
tls-openssl = { package = "openssl", version = "0.10.55" } tls-openssl = { package = "openssl", version = "0.10.55" }
tls-rustls = { package = "rustls", version = "0.23" } tls-rustls = { package = "rustls", version = "0.23" }
tokio = { version = "1.24.2", features = ["rt-multi-thread", "macros"] } tokio = { version = "1.24.2", features = ["rt-multi-thread", "macros"] }
tokio-util = "0.7"
zstd = "0.13" zstd = "0.13"
[lints] [lints]

View File

@ -1,8 +1,6 @@
use std::{ use std::{
any::Any, any::Any,
cmp, fmt, cmp, fmt, io,
future::Future,
io,
marker::PhantomData, marker::PhantomData,
net, net,
sync::{Arc, Mutex}, sync::{Arc, Mutex},
@ -66,7 +64,6 @@ struct Config {
/// .await /// .await
/// } /// }
/// ``` /// ```
#[must_use]
pub struct HttpServer<F, I, S, B> pub struct HttpServer<F, I, S, B>
where where
F: Fn() -> I + Send + Clone + 'static, F: Fn() -> I + Send + Clone + 'static,
@ -315,37 +312,6 @@ where
self self
} }
/// Specify shutdown signal from a future.
///
/// Using this method will prevent OS signal handlers being set up.
///
/// Typically, a `CancellationToken` will be used, but any future _can_ be.
///
/// # Examples
///
/// ```no_run
/// use actix_web::{App, HttpServer};
/// use tokio_util::sync::CancellationToken;
///
/// # #[actix_web::main]
/// # async fn main() -> std::io::Result<()> {
/// let stop_signal = CancellationToken::new();
///
/// HttpServer::new(move || App::new())
/// .shutdown_signal(stop_signal.cancelled_owned())
/// .bind(("127.0.0.1", 8080))?
/// .run()
/// .await
/// # }
/// ```
pub fn shutdown_signal<Fut>(mut self, shutdown_signal: Fut) -> Self
where
Fut: Future<Output = ()> + Send + 'static,
{
self.builder = self.builder.shutdown_signal(shutdown_signal);
self
}
/// Sets timeout for graceful worker shutdown of workers. /// Sets timeout for graceful worker shutdown of workers.
/// ///
/// After receiving a stop signal, workers have this much time to finish serving requests. /// After receiving a stop signal, workers have this much time to finish serving requests.
@ -1107,7 +1073,10 @@ fn bind_addrs(addrs: impl net::ToSocketAddrs, backlog: u32) -> io::Result<Vec<ne
} else if let Some(err) = err.take() { } else if let Some(err) = err.take() {
Err(err) Err(err)
} else { } else {
Err(io::Error::other("Could not bind to address")) Err(io::Error::new(
io::ErrorKind::Other,
"Can not bind to address.",
))
} }
} }

View File

@ -2,8 +2,6 @@
## Unreleased ## Unreleased
- Update `brotli` dependency to `8`.
## 3.6.0 ## 3.6.0
- Prevent panics on connection pool drop when Tokio runtime is shutdown early. - Prevent panics on connection pool drop when Tokio runtime is shutdown early.

View File

@ -141,7 +141,7 @@ actix-tls = { version = "3.4", features = ["openssl", "rustls-0_23"] }
actix-utils = "3" actix-utils = "3"
actix-web = { version = "4", features = ["openssl"] } actix-web = { version = "4", features = ["openssl"] }
brotli = "8" brotli = "7"
const-str = "0.5" const-str = "0.5"
env_logger = "0.11" env_logger = "0.11"
flate2 = "1.0.13" flate2 = "1.0.13"

View File

@ -179,8 +179,9 @@ where
.acquire_owned() .acquire_owned()
.await .await
.map_err(|_| { .map_err(|_| {
ConnectError::Io(io::Error::other( ConnectError::Io(io::Error::new(
"Failed to acquire semaphore on client connection pool", io::ErrorKind::Other,
"failed to acquire semaphore on client connection pool",
)) ))
})?; })?;

View File

@ -1,8 +1,6 @@
_list: _list:
@just --list @just --list
toolchain := ""
# Format workspace. # Format workspace.
fmt: fmt:
just --unstable --fmt just --unstable --fmt
@ -12,11 +10,11 @@ fmt:
# Downgrade dependencies necessary to run MSRV checks/tests. # Downgrade dependencies necessary to run MSRV checks/tests.
[private] [private]
downgrade-for-msrv: downgrade-for-msrv:
cargo {{ toolchain }} update -p=divan --precise=0.1.15 # next ver: 1.80.0 cargo update -p=clap --precise=4.4.18 # next ver: 1.74.0
cargo {{ toolchain }} update -p=half --precise=2.4.1 # next ver: 1.81.0 cargo update -p=divan --precise=0.1.15 # next ver: 1.80.0
cargo {{ toolchain }} update -p=litemap --precise=0.7.4 # next ver: 1.81.0 cargo update -p=litemap --precise=0.7.4 # next ver: 1.81.0
cargo {{ toolchain }} update -p=zerofrom --precise=0.1.5 # next ver: 1.81.0 cargo update -p=zerofrom --precise=0.1.5 # next ver: 1.81.0
cargo {{ toolchain }} update -p=idna_adapter --precise=1.2.0 # next ver: 1.82.0 cargo update -p=half --precise=2.4.1 # next ver: 1.81.0
msrv := ``` msrv := ```
cargo metadata --format-version=1 \ cargo metadata --format-version=1 \
@ -42,43 +40,41 @@ check-default:
cargo hack --workspace check cargo hack --workspace check
# Run Clippy over workspace. # Run Clippy over workspace.
check: && clippy check toolchain="": && (clippy toolchain)
# Run Clippy over workspace. # Run Clippy over workspace.
clippy: clippy toolchain="":
cargo {{ toolchain }} clippy --workspace --all-targets {{ all_crate_features }} cargo {{ toolchain }} clippy --workspace --all-targets {{ all_crate_features }}
# Test workspace using MSRV. # Test workspace using MSRV.
test-msrv: test-msrv: downgrade-for-msrv (test msrv_rustup)
@just toolchain={{ msrv_rustup }} downgrade-for-msrv
@just toolchain={{ msrv_rustup }} test
# Test workspace code. # Test workspace code.
test: test toolchain="":
cargo {{ toolchain }} test --lib --tests -p=actix-web-codegen --all-features cargo {{ toolchain }} test --lib --tests -p=actix-web-codegen --all-features
cargo {{ toolchain }} test --lib --tests -p=actix-multipart-derive --all-features cargo {{ toolchain }} test --lib --tests -p=actix-multipart-derive --all-features
cargo {{ toolchain }} nextest run --no-tests=warn -p=actix-router --no-default-features cargo {{ toolchain }} nextest run --no-tests=warn -p=actix-router --no-default-features
cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-web-codegen --exclude=actix-multipart-derive {{ all_crate_features }} --filter-expr="not test(test_reading_deflate_encoding_large_random_rustls)" cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-web-codegen --exclude=actix-multipart-derive {{ all_crate_features }} --filter-expr="not test(test_reading_deflate_encoding_large_random_rustls)"
# Test workspace docs. # Test workspace docs.
test-docs: && doc test-docs toolchain="": && doc
cargo {{ toolchain }} test --doc --workspace {{ all_crate_features }} --no-fail-fast -- --nocapture cargo {{ toolchain }} test --doc --workspace {{ all_crate_features }} --no-fail-fast -- --nocapture
# Test workspace. # Test workspace.
test-all: test test-docs test-all toolchain="": (test toolchain) (test-docs toolchain)
# Test workspace and collect coverage info. # Test workspace and collect coverage info.
[private] [private]
test-coverage: test-coverage toolchain="":
cargo {{ toolchain }} llvm-cov nextest --no-tests=warn --no-report {{ all_crate_features }} cargo {{ toolchain }} llvm-cov nextest --no-tests=warn --no-report {{ all_crate_features }}
cargo {{ toolchain }} llvm-cov --doc --no-report {{ all_crate_features }} cargo {{ toolchain }} llvm-cov --doc --no-report {{ all_crate_features }}
# Test workspace and generate Codecov report. # Test workspace and generate Codecov report.
test-coverage-codecov: test-coverage test-coverage-codecov toolchain="": (test-coverage toolchain)
cargo {{ toolchain }} llvm-cov report --doctests --codecov --output-path=codecov.json cargo {{ toolchain }} llvm-cov report --doctests --codecov --output-path=codecov.json
# Test workspace and generate LCOV report. # Test workspace and generate LCOV report.
test-coverage-lcov: test-coverage test-coverage-lcov toolchain="": (test-coverage toolchain)
cargo {{ toolchain }} llvm-cov report --doctests --lcov --output-path=lcov.info cargo {{ toolchain }} llvm-cov report --doctests --lcov --output-path=lcov.info
# Document crates in workspace. # Document crates in workspace.