From 7ca2785c8252af1cedee04040e1a30d81494ee8e Mon Sep 17 00:00:00 2001 From: Jose Quintana <1700322+joseluisq@users.noreply.github.com> Date: Tue, 27 May 2025 00:25:29 +0200 Subject: [PATCH] chore: update dependencies 26.05.2025 and MSRV 1.81.0 (#545) - BREAKING: End support for unmaintained Windows 7, 8, 8.1 platforms as previously announced on v2.36.1. - SECURITY (RUSTSEC-2024-0437): Crash due to uncontrolled recursion in protobuf crate was temporarily solved in the previous release. However, this PR applies the dependency patches recently available. - RESTORED: `experimental` Cargo feature for metrics and in-memory cache. --- .cargo/audit.toml | 8 --- .github/workflows/devel.yml | 8 +-- .github/workflows/release.yml | 6 +- Cargo.lock | 88 +++++++++++++++++----------- Cargo.toml | 17 ++---- build.rs | 7 ++- docs/content/building-from-source.md | 4 +- tests/experimental_metrics.rs | 5 +- 8 files changed, 78 insertions(+), 65 deletions(-) diff --git a/.cargo/audit.toml b/.cargo/audit.toml index 9f684112..b28486df 100644 --- a/.cargo/audit.toml +++ b/.cargo/audit.toml @@ -1,9 +1 @@ [advisories] -ignore = [ - # NOTE: - # Ignored and disabled from the `static-web-server` final binary (experimental feature) temporarily. - # See - # - https://github.com/tikv/rust-prometheus/issues/538 - # - https://github.com/Hanaasagi/tokio-metrics-collector/issues/26 - "RUSTSEC-2024-0437" -] diff --git a/.github/workflows/devel.yml b/.github/workflows/devel.yml index 0e10984d..f35ef767 100644 --- a/.github/workflows/devel.yml +++ b/.github/workflows/devel.yml @@ -74,7 +74,7 @@ jobs: # We test against the latest and minimum Rust stable version. - build: pinned os: ubuntu-22.04 - rust: 1.76.0 + rust: 1.81.0 # Some of our release builds are generated by a nightly compiler to take # advantage of the latest optimizations/compile time improvements. - build: linux-musl @@ -148,11 +148,11 @@ jobs: target: aarch64-apple-darwin - build: windows-msvc os: windows-2022 - rust: 1.77.2 + rust: stable target: x86_64-pc-windows-msvc - build: windows-msvc-i686 os: windows-2022 - rust: 1.77.2 + rust: stable target: i686-pc-windows-msvc - build: windows-msvc-arm64 os: windows-2022 @@ -160,7 +160,7 @@ jobs: target: aarch64-pc-windows-msvc - build: windows-pc-gnu os: windows-2022 - rust: 1.77.2 + rust: stable target: x86_64-pc-windows-gnu steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bac3448f..65cfcd94 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -142,11 +142,11 @@ jobs: target: aarch64-apple-darwin - build: windows-msvc os: windows-2022 - rust: 1.77.2 + rust: stable target: x86_64-pc-windows-msvc - build: windows-msvc-i686 os: windows-2022 - rust: 1.77.2 + rust: stable target: i686-pc-windows-msvc - build: windows-msvc-arm64 os: windows-2022 @@ -154,7 +154,7 @@ jobs: target: aarch64-pc-windows-msvc - build: windows-pc-gnu os: windows-2022 - rust: 1.77.2 + rust: stable target: x86_64-pc-windows-gnu steps: diff --git a/Cargo.lock b/Cargo.lock index 2bf2ec9c..69445361 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -368,7 +368,7 @@ dependencies = [ "clap_complete_fig", "clap_complete_nushell", "clap_mangen", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -460,12 +460,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "const_fn" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f8a2ca5ac02d09563609681103aada9e1777d54fc57a5acd7a41404f9c93b6e" - [[package]] name = "const_format" version = "0.2.34" @@ -727,9 +721,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "git2" -version = "0.19.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" +checksum = "2deb07a133b1520dc1a5690e9bd08950108873d7ed5de38dcc74d3b5ebffa110" dependencies = [ "bitflags", "libc", @@ -1120,9 +1114,9 @@ checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "libgit2-sys" -version = "0.17.0+1.8.1" +version = "0.18.1+1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" +checksum = "e1dcb20f84ffcdd825c7a311ae347cce604a6f084a767dec4a4929829645290e" dependencies = [ "cc", "libc", @@ -1411,9 +1405,9 @@ dependencies = [ [[package]] name = "prometheus" -version = "0.13.4" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d33c28a30771f7f96db69893f78b857f7450d7e0237e9c8fc6427a81bae7ed1" +checksum = "3ca5326d8d0b950a9acd87e6a3f94745394f62e4dae1b1ee22b2bc0c394af43a" dependencies = [ "cfg-if", "fnv", @@ -1421,14 +1415,28 @@ dependencies = [ "memchr", "parking_lot", "protobuf", - "thiserror", + "thiserror 2.0.12", ] [[package]] name = "protobuf" -version = "2.28.0" +version = "3.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" +checksum = "d65a1d4ddae7d8b5de68153b48f6aa3bba8cb002b243dbdbc55a5afbc98f99f4" +dependencies = [ + "once_cell", + "protobuf-support", + "thiserror 1.0.69", +] + +[[package]] +name = "protobuf-support" +version = "3.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e36c2f31e0a47f9280fb347ef5e461ffcd2c52dd520d8e216b52f93b0b0d7d6" +dependencies = [ + "thiserror 1.0.69", +] [[package]] name = "pulldown-cmark" @@ -1697,9 +1705,9 @@ dependencies = [ [[package]] name = "shadow-rs" -version = "0.36.1" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd2f59f8b166e94269530e0f47323c8b2a5b2d82ef90363cc7ce1e517e063f78" +checksum = "6d5625ed609cf66d7e505e7d487aca815626dc4ebb6c0dd07637ca61a44651a6" dependencies = [ "const_format", "git2", @@ -1823,7 +1831,6 @@ dependencies = [ "hyper", "lazy_static", "listenfd", - "litemap", "maud", "mime_guess", "mini-moka", @@ -1848,8 +1855,6 @@ dependencies = [ "tracing", "tracing-subscriber", "windows-service", - "zerofrom", - "zerofrom-derive", ] [[package]] @@ -1917,7 +1922,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl 2.0.12", ] [[package]] @@ -1931,6 +1945,17 @@ dependencies = [ "syn", ] +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -2046,9 +2071,9 @@ dependencies = [ [[package]] name = "tokio-metrics-collector" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a78b1d1a001e75e5f29669ac7b9288f44ad1af7afcbd6ea77add41214db716" +checksum = "f360c6fa7fd188e65904979ea07f1f44c57f0759ab18ecca88551c26acdf4cd6" dependencies = [ "lazy_static", "parking_lot", @@ -2197,18 +2222,15 @@ checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "tz-rs" -version = "0.6.14" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33851b15c848fad2cf4b105c6bb66eb9512b6f6c44a4b13f57c53c73c707e2b4" -dependencies = [ - "const_fn", -] +checksum = "e1450bf2b99397e72070e7935c89facaa80092ac812502200375f1f7d33c71a1" [[package]] name = "tzdb" -version = "0.6.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b580f6b365fa89f5767cdb619a55d534d04a4e14c2d7e5b9a31e94598687fb1" +checksum = "0be2ea5956f295449f47c0b825c5e109022ff1a6a53bb4f77682a87c2341fbf5" dependencies = [ "iana-time-zone", "tz-rs", @@ -2217,9 +2239,9 @@ dependencies = [ [[package]] name = "tzdb_data" -version = "0.1.4" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4471adcfcbd3052e8c5b5890a04a559837444b3be26b9cbbd622063171cec9d" +checksum = "9c4c81d75033770e40fbd3643ce7472a1a9fd301f90b7139038228daf8af03ec" dependencies = [ "tz-rs", ] diff --git a/Cargo.toml b/Cargo.toml index c746ec53..a03284d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "static-web-server" version = "2.36.1" edition = "2021" -rust-version = "1.76.0" +rust-version = "1.81.0" authors = ["Jose Quintana "] license = "MIT OR Apache-2.0" description = "A cross-platform, high-performance and asynchronous web server for static files-serving." @@ -40,7 +40,7 @@ doc = false # All features enabled by default default = ["compression", "http2", "directory-listing", "basic-auth", "fallback-page"] # Include all features (used when building SWS binaries) -all = ["default"] +all = ["default", "experimental"] # HTTP2 http2 = ["tokio-rustls", "rustls-pemfile"] # Compression @@ -89,7 +89,7 @@ serde = { version = "1.0", default-features = false, features = ["derive"] } serde_ignored = "0.1" serde_json = "1.0" serde_repr = "0.1" -shadow-rs = "0.36" +shadow-rs = "1.1.1" tokio = { version = "1", default-features = false, features = ["rt-multi-thread", "macros", "fs", "io-util", "signal"] } tokio-rustls = { version = "0.26", optional = true, default-features = false, features = ["logging", "tls12", "ring"] } tokio-util = { version = "0.7", default-features = false, features = ["io"] } @@ -97,19 +97,14 @@ toml = "0.8" tracing = { version = "0.1", default-features = false, features = ["std"] } tracing-subscriber = { version = "0.3", default-features = false, features = ["smallvec", "registry", "parking_lot", "fmt", "ansi", "tracing-log"] } -# NOTE: pinning dependencies temporarily (MSRV 1.76.0) because 0.1.6+ requires rustc 1.81 or newer -zerofrom = "=0.1.5" -zerofrom-derive = "=0.1.5" -litemap = "=0.7.4" - [target.'cfg(all(target_env = "musl", target_pointer_width = "64"))'.dependencies.tikv-jemallocator] version = "0.6" [target.'cfg(unix)'.dependencies] signal-hook = { version = "0.3", features = ["extended-siginfo"] } signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"], default-features = false } -tokio-metrics-collector = { version = "0.3", optional = true } -prometheus = { version = "0.13.4", default-features = false, optional = true } +tokio-metrics-collector = { version = "0.3.1", optional = true } +prometheus = { version = "0.14.0", default-features = false, optional = true } [target.'cfg(windows)'.dependencies] windows-service = "0.7" @@ -119,7 +114,7 @@ bytes = "1.10" serde_json = "1.0" [build-dependencies] -shadow-rs = "0.36" +shadow-rs = "1.1.1" [profile.release] codegen-units = 1 diff --git a/build.rs b/build.rs index 4a0dfc45..607cefa7 100644 --- a/build.rs +++ b/build.rs @@ -1,3 +1,6 @@ -fn main() -> shadow_rs::SdResult<()> { - shadow_rs::new() +use shadow_rs::{SdResult, ShadowBuilder}; + +fn main() -> SdResult<()> { + ShadowBuilder::builder().build()?; + Ok(()) } diff --git a/docs/content/building-from-source.md b/docs/content/building-from-source.md index 39710ddd..ec1b0e19 100644 --- a/docs/content/building-from-source.md +++ b/docs/content/building-from-source.md @@ -6,7 +6,7 @@ Follow these instructions to either build **`SWS`** project from the source or t If you want to build **SWS** from the source, all you need is a [Rust 2021 Edition](https://blog.rust-lang.org/2021/05/11/edition-2021.html) installed. -So make sure to install Rust [1.76.0](https://blog.rust-lang.org/2024/02/08/Rust-1.76.0.html) or newer (or nightly) along with [the toolchain(s)](https://rust-lang.github.io/rustup/concepts/toolchains.html) of your preference. +So make sure to install Rust [1.81.0](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0/) or newer (or nightly) along with [the toolchain(s)](https://rust-lang.github.io/rustup/concepts/toolchains.html) of your preference. Then clone the repository and use [Cargo](https://doc.rust-lang.org/cargo/) to build the project from the source. @@ -16,7 +16,7 @@ cd static-web-server cargo build --release ``` -Finally, the release binary should be available at `target/https://blog.rust-lang.org/2024/02/08/Rust-1.76.0.htmlrelease/static-web-server` or under your toolchain directory chosen. +Finally, the release binary should be available at `target/release/static-web-server` or under your toolchain directory chosen. !!! info "Don't use the project's `Makefile`" Please don't use the project's `Makefile` since it's only intended for development and some on-demand tasks. diff --git a/tests/experimental_metrics.rs b/tests/experimental_metrics.rs index 16bde81a..91addee7 100644 --- a/tests/experimental_metrics.rs +++ b/tests/experimental_metrics.rs @@ -9,13 +9,14 @@ pub mod tests { use std::net::SocketAddr; use static_web_server::testing::fixtures::{ - fixture_req_handler, fixture_settings, REMOTE_ADDR, + fixture_req_handler, fixture_req_handler_opts, fixture_settings, REMOTE_ADDR, }; #[tokio::test] async fn experimental_metrics_enabled() { let opts = fixture_settings("toml/experimental_metrics.toml"); - let req_handler = fixture_req_handler(opts.general, opts.advanced); + let req_handler_opts = fixture_req_handler_opts(opts.general, opts.advanced); + let req_handler = fixture_req_handler(req_handler_opts); let remote_addr = Some(REMOTE_ADDR.parse::().unwrap()); let mut req = Request::default();