From de4ece538422d76b8a13a35c01aaf05c80b62244 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Wed, 29 Oct 2025 11:35:18 +0000 Subject: [PATCH 1/8] Make proxy std only `proxy` only works with `std` and causes an error in `no-std`. Add `std` to the `proxy` feature. --- bitreq/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitreq/Cargo.toml b/bitreq/Cargo.toml index 4629c3e0..53b19def 100644 --- a/bitreq/Cargo.toml +++ b/bitreq/Cargo.toml @@ -50,7 +50,7 @@ https = ["https-rustls"] https-rustls = ["rustls", "webpki-roots", "rustls-webpki"] https-rustls-probe = ["rustls", "rustls-native-certs"] json-using-serde = ["serde", "serde_json"] -proxy = ["base64"] +proxy = ["base64", "std"] async = ["tokio", "std"] async-https = ["async", "https-rustls", "tokio-rustls"] From cf0e5a5f54b54e258c14892c97315e35a15d38b7 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Wed, 29 Oct 2025 11:07:35 +0000 Subject: [PATCH 2/8] Replace LazyLock with OnceLock LazyLock only stabilizes in rustc 1.80 and causes a CI test error. OnceLock is stable since 1.70 and has the required functionality. Use OnceLock instead of LazyLock. --- bitreq/src/connection/rustls_stream.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bitreq/src/connection/rustls_stream.rs b/bitreq/src/connection/rustls_stream.rs index f0fe7ba6..23854501 100644 --- a/bitreq/src/connection/rustls_stream.rs +++ b/bitreq/src/connection/rustls_stream.rs @@ -5,6 +5,7 @@ use alloc::sync::Arc; use core::convert::TryFrom; use std::io::{self, Write}; use std::net::TcpStream; +use std::sync::OnceLock; use rustls::{self, ClientConfig, ClientConnection, RootCertStore, ServerName, StreamOwned}; #[cfg(feature = "rustls-webpki")] @@ -15,8 +16,9 @@ use crate::Error; pub type SecuredStream = StreamOwned; -#[allow(clippy::incompatible_msrv)] // We only guarantee MSRV for a subset of features. -static CONFIG: std::sync::LazyLock> = std::sync::LazyLock::new(|| { +static CONFIG: OnceLock> = OnceLock::new(); + +fn build_client_config() -> Arc { let mut root_certificates = RootCertStore::empty(); // Try to load native certs @@ -44,7 +46,7 @@ static CONFIG: std::sync::LazyLock> = std::sync::LazyLock::new .with_root_certificates(root_certificates) .with_no_client_auth(); Arc::new(config) -}); +} pub fn create_secured_stream(conn: &Connection) -> Result { // Rustls setup @@ -54,8 +56,8 @@ pub fn create_secured_stream(conn: &Connection) -> Result { Ok(result) => result, Err(err) => return Err(Error::IoError(io::Error::new(io::ErrorKind::Other, err))), }; - let sess = - ClientConnection::new(CONFIG.clone(), dns_name).map_err(Error::RustlsCreateConnection)?; + let sess = ClientConnection::new(CONFIG.get_or_init(build_client_config).clone(), dns_name) + .map_err(Error::RustlsCreateConnection)?; // Connect #[cfg(feature = "log")] From f97b8c660d98c77121b897440bacc03e480a08e5 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Wed, 29 Oct 2025 10:54:48 +0000 Subject: [PATCH 3/8] Remove trailing whitespaces from no-std example --- bitreq/examples/no-std.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bitreq/examples/no-std.rs b/bitreq/examples/no-std.rs index 1ebffc54..d4c7111c 100644 --- a/bitreq/examples/no-std.rs +++ b/bitreq/examples/no-std.rs @@ -16,7 +16,7 @@ const _RESPONSE: &str = r#" margin: 0; padding: 0; font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; - + } div { width: 600px; @@ -36,7 +36,7 @@ const _RESPONSE: &str = r#" width: auto; } } - + From 921652dfaa769eb0b89719c48bf48edfedfafab0 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Wed, 29 Oct 2025 10:54:48 +0000 Subject: [PATCH 4/8] Remove std attribute from no-std example The example `no-std.rs`, which is currently broken and commented out, fails to compile without `std` because it has a crate level attribute `#![cfg(feature = "std")]`. Remove the `std` attribute so that the (broken) example compiles with `no-std`. --- bitreq/examples/no-std.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/bitreq/examples/no-std.rs b/bitreq/examples/no-std.rs index d4c7111c..f682bc83 100644 --- a/bitreq/examples/no-std.rs +++ b/bitreq/examples/no-std.rs @@ -1,7 +1,5 @@ //! This is a simple example to demonstrate the usage of this library. -#![cfg(feature = "std")] - const _RESPONSE: &str = r#" From 8f30a45ec3dc6eb6630f27f964ce68276b1a3497 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Tue, 28 Oct 2025 09:17:40 +0000 Subject: [PATCH 5/8] Add testvars.sh to bitreq Add all of the features to the lists. async, async-https and proxy require std and are therfore not listed in the no-std features. --- bitreq/contrib/test_vars.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 bitreq/contrib/test_vars.sh diff --git a/bitreq/contrib/test_vars.sh b/bitreq/contrib/test_vars.sh new file mode 100644 index 00000000..5e9177e8 --- /dev/null +++ b/bitreq/contrib/test_vars.sh @@ -0,0 +1,14 @@ +# No shebang, this file should not be executed. +# shellcheck disable=SC2148 +# +# disable verify unused vars, despite the fact that they are used when sourced +# shellcheck disable=SC2034 + +# Test all these features with "std" enabled. +FEATURES_WITH_STD="log https https-rustls proxy async async-https" + +# Test all these features without "std" enabled. +FEATURES_WITHOUT_STD="log https https-rustls" + +# Run these examples. +EXAMPLES="" From df90f001b2e504662e6441409cedfeab848fe89f Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Wed, 29 Oct 2025 10:45:26 +0000 Subject: [PATCH 6/8] Add bitreq to list of crates to test Reorder the list alphabetically and add bitreq. --- contrib/crates.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/crates.sh b/contrib/crates.sh index 1362f549..c084fcb1 100755 --- a/contrib/crates.sh +++ b/contrib/crates.sh @@ -2,4 +2,4 @@ # shellcheck disable=SC2148 # Crates in this workspace to test. -CRATES=("types" "client" "jsonrpc") +CRATES=("bitreq" "client" "jsonrpc" "types") From 9fd5af7fb0d40653dc77954d35beed3716737a39 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Mon, 27 Oct 2025 11:17:03 +0000 Subject: [PATCH 7/8] Remove bitreq github workflows bitreq is now part of the corepc workspace and the github workflow files in its subdirectory are not run anymore. Remove these files. --- bitreq/.github/workflows/lint.yml | 29 ------------ bitreq/.github/workflows/msrv.yml | 24 ---------- bitreq/.github/workflows/unit-tests.yml | 63 ------------------------- 3 files changed, 116 deletions(-) delete mode 100644 bitreq/.github/workflows/lint.yml delete mode 100644 bitreq/.github/workflows/msrv.yml delete mode 100644 bitreq/.github/workflows/unit-tests.yml diff --git a/bitreq/.github/workflows/lint.yml b/bitreq/.github/workflows/lint.yml deleted file mode 100644 index 9d7048f3..00000000 --- a/bitreq/.github/workflows/lint.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: lint - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -env: - CARGO_TERM_COLOR: always - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout Crate - uses: actions/checkout@v3 - - name: Set Toolchain - # https://github.com/dtolnay/rust-toolchain - uses: dtolnay/rust-toolchain@stable - - name: Run rustfmt - # rustfmt defaults to edition 2015 it seems. - run: rustfmt --check --edition=2018 src/lib.rs - - name: Run cargo doc - run: cargo doc --features "punycode proxy https" - - name: Run clippy - run: | - cargo clippy --all-targets --features "punycode proxy https-rustls" -- --no-deps -D warnings - cargo clippy --all-targets --features "punycode proxy https-rustls-probe" -- --no-deps -D warnings diff --git a/bitreq/.github/workflows/msrv.yml b/bitreq/.github/workflows/msrv.yml deleted file mode 100644 index aede3509..00000000 --- a/bitreq/.github/workflows/msrv.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: msrv - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - schedule: - - cron: "47 5 * * 6" - -env: - CARGO_TERM_COLOR: always - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout Crate - uses: actions/checkout@v3 - - name: Checkout Toolchain - uses: dtolnay/rust-toolchain@1.75 - - name: Running test script - run: | - cargo test diff --git a/bitreq/.github/workflows/unit-tests.yml b/bitreq/.github/workflows/unit-tests.yml deleted file mode 100644 index d91899be..00000000 --- a/bitreq/.github/workflows/unit-tests.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: unit-tests - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -env: - CARGO_TERM_COLOR: always - -jobs: - test-linux: - runs-on: ubuntu-latest - steps: - - name: Checkout Crate - uses: actions/checkout@v3 - - name: Set Toolchain - # https://github.com/dtolnay/rust-toolchain - uses: dtolnay/rust-toolchain@stable - - name: Build - run: cargo build - - name: Test - run: | - cargo test - cargo test --features punycode - cargo test --features proxy - cargo test --features urlencoding - cargo test --features https - test-windows: - runs-on: windows-latest - steps: - - name: Checkout Crate - uses: actions/checkout@v3 - - name: Set Toolchain - uses: dtolnay/rust-toolchain@stable - - name: Build - run: cargo build - - name: Test - run: | - cargo test - cargo test --features punycode - cargo test --features proxy - cargo test --features urlencoding - cargo test --features https - cargo test --features "punycode proxy urlencoding https" - test-macos: - runs-on: macos-latest - steps: - - name: Checkout Crate - uses: actions/checkout@v3 - - name: Set Toolchain - uses: dtolnay/rust-toolchain@stable - - name: Build - run: cargo build - - name: Test - run: | - cargo test - cargo test --features punycode - cargo test --features proxy - cargo test --features urlencoding - cargo test --features https - cargo test --features "punycode proxy urlencoding https" From 3497da8fde208d0ac204fa05e655382f54f54f88 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Mon, 27 Oct 2025 11:17:03 +0000 Subject: [PATCH 8/8] Remove bitreq README.md MSRV and test badges These badges were linked to workflows that are no longer run on this crate individually. --- bitreq/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/bitreq/README.md b/bitreq/README.md index 90e940b3..0acc219b 100644 --- a/bitreq/README.md +++ b/bitreq/README.md @@ -1,8 +1,6 @@ # bitreq - forked from minreq [![Crates.io](https://img.shields.io/crates/d/bitreq.svg)](https://crates.io/crates/bitreq) [![Documentation](https://docs.rs/bitreq/badge.svg)](https://docs.rs/bitreq) -![Unit tests](https://github.com/tcharding/bitreq/actions/workflows/unit-tests.yml/badge.svg) -![MSRV](https://github.com/tcharding/bitreq/actions/workflows/msrv.yml/badge.svg) This crate is a fork for the very nice [minreq](https://github.com/neonmoe/minreq). I chose to fork and