From d69be718b615cb9c354c5bb4a9b90f262edddc08 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 15 Jan 2026 12:49:46 +0000 Subject: [PATCH 1/5] [bitreq] Make `Error` `#[non_exhaustive]` Sadly `Error` has different fields based on different features, so to avoid downstream crates randomly breaking due to unrelated feature flag settings, we need to mark it `non_exhaustive`. --- bitreq/src/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitreq/src/error.rs b/bitreq/src/error.rs index 56f39a38..b4a89541 100644 --- a/bitreq/src/error.rs +++ b/bitreq/src/error.rs @@ -4,7 +4,7 @@ use std::{error, io}; /// Represents an error while sending, receiving, or parsing an HTTP response. #[derive(Debug)] -// TODO: Make non-exhaustive for 3.0? +#[non_exhaustive] // TODO: Maybe make a few inner error types containing groups of these, based on // what the user might want to handle? This error doesn't really invite graceful // handling. From 99acf708330057ca6e4a3eea12cf93777588100b Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 15 Jan 2026 12:59:07 +0000 Subject: [PATCH 2/5] [bitreq] Drop mention port port 1080 which is for SOCKS, not HTTP --- bitreq/src/proxy.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitreq/src/proxy.rs b/bitreq/src/proxy.rs index 1c07374b..adab733c 100644 --- a/bitreq/src/proxy.rs +++ b/bitreq/src/proxy.rs @@ -49,7 +49,7 @@ impl Proxy { /// [http://][user[:password]@]host[:port] /// ``` /// - /// The default port is 8080, to be changed to 1080 in bitreq 3.0. + /// The default port is 8080. /// /// # Example /// From bc4f41ac43483745f4ed374df205dbd35ed72af4 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 15 Jan 2026 13:01:15 +0000 Subject: [PATCH 3/5] [bitreq] Rename `Proxy::new` to `Proxy::new_http` In the future we'd like to support SOCKS proxies as well, so get ahead of it by renaming `Proxy::new` to `Proxy::new_http` to allow us to have a `Proxy::new_socks5` in a point release. --- bitreq/src/error.rs | 2 +- bitreq/src/lib.rs | 2 +- bitreq/src/proxy.rs | 10 +++++----- bitreq/src/request.rs | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bitreq/src/error.rs b/bitreq/src/error.rs index b4a89541..9eb4346d 100644 --- a/bitreq/src/error.rs +++ b/bitreq/src/error.rs @@ -60,7 +60,7 @@ pub enum Error { /// and as such, a connection cannot be made. HttpsFeatureNotEnabled, /// The provided proxy information was not properly formatted. See - /// [Proxy::new](crate::Proxy::new) for the valid format. + /// [Proxy](crate::Proxy) methods for the valid format. #[cfg(feature = "proxy")] BadProxy, /// The provided credentials were rejected by the proxy server. diff --git a/bitreq/src/lib.rs b/bitreq/src/lib.rs index 1fb0f5d8..b8a53bbd 100644 --- a/bitreq/src/lib.rs +++ b/bitreq/src/lib.rs @@ -207,7 +207,7 @@ //! # fn main() -> Result<(), Box> { //! #[cfg(feature = "proxy")] //! { -//! let proxy = bitreq::Proxy::new("localhost:8080")?; +//! let proxy = bitreq::Proxy::new_http("localhost:8080")?; //! let response = bitreq::post("http://example.com") //! .with_proxy(proxy) //! .send()?; diff --git a/bitreq/src/proxy.rs b/bitreq/src/proxy.rs index adab733c..37d9673c 100644 --- a/bitreq/src/proxy.rs +++ b/bitreq/src/proxy.rs @@ -41,7 +41,7 @@ impl Proxy { } } - /// Creates a new Proxy configuration. + /// Creates a new Proxy configuration for an HTTP proxy supporting the `CONNECT` command. /// /// Supported proxy format is: /// @@ -54,11 +54,11 @@ impl Proxy { /// # Example /// /// ``` - /// let proxy = bitreq::Proxy::new("user:password@localhost:1080").unwrap(); + /// let proxy = bitreq::Proxy::new_http("user:password@localhost:1080").unwrap(); /// let request = bitreq::post("http://example.com").with_proxy(proxy); /// ``` /// - pub fn new>(proxy: S) -> Result { + pub fn new_http>(proxy: S) -> Result { let proxy = proxy.as_ref(); let authority = if let Some((proto, auth)) = split_once(proxy, "://") { if proto != "http" { @@ -141,7 +141,7 @@ mod tests { #[test] fn parse_proxy() { - let proxy = Proxy::new("user:p@ssw0rd@localhost:9999").unwrap(); + let proxy = Proxy::new_http("user:p@ssw0rd@localhost:9999").unwrap(); assert_eq!(proxy.user, Some(String::from("user"))); assert_eq!(proxy.password, Some(String::from("p@ssw0rd"))); assert_eq!(proxy.server, String::from("localhost")); @@ -150,7 +150,7 @@ mod tests { #[test] fn parse_regular_proxy_with_protocol() { - let proxy = Proxy::new("http://localhost:1080").unwrap(); + let proxy = Proxy::new_http("http://localhost:1080").unwrap(); assert_eq!(proxy.user, None); assert_eq!(proxy.password, None); assert_eq!(proxy.server, String::from("localhost")); diff --git a/bitreq/src/request.rs b/bitreq/src/request.rs index 9193ba80..bea06733 100644 --- a/bitreq/src/request.rs +++ b/bitreq/src/request.rs @@ -393,14 +393,14 @@ impl ParsedRequest { if let Ok(proxy) = std::env::var("https_proxy").map_err(|_| std::env::var("HTTPS_PROXY")) { - if let Ok(proxy) = Proxy::new(proxy) { + if let Ok(proxy) = Proxy::new_http(proxy) { config.proxy = Some(proxy); } } } // Set HTTP proxies if request's protocol is HTTP and they're given else if let Ok(proxy) = std::env::var("http_proxy") { - if let Ok(proxy) = Proxy::new(proxy) { + if let Ok(proxy) = Proxy::new_http(proxy) { config.proxy = Some(proxy); } } @@ -408,7 +408,7 @@ impl ParsedRequest { else if let Ok(proxy) = std::env::var("all_proxy").map_err(|_| std::env::var("ALL_PROXY")) { - if let Ok(proxy) = Proxy::new(proxy) { + if let Ok(proxy) = Proxy::new_http(proxy) { config.proxy = Some(proxy); } } From 51ffafdbea051fcbb5c4bc5c110541bd1268e487 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 15 Jan 2026 12:51:09 +0000 Subject: [PATCH 4/5] [bitreq] Bump crate version to 0.3 I believe we should go ahead and release bitreq 0.3 with all the changes we made to it, as its a substantial improvement for async clients and now something that could reasonably be used in place of `reqwest` in most cases. There's some remaining proxy issues, but those can be resolved in a point release without API change. --- Cargo-minimal.lock | 2 +- Cargo-recent.lock | 2 +- bitreq/Cargo.toml | 2 +- jsonrpc/Cargo.toml | 2 +- node/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo-minimal.lock b/Cargo-minimal.lock index dfff74bc..8cf19276 100644 --- a/Cargo-minimal.lock +++ b/Cargo-minimal.lock @@ -141,7 +141,7 @@ checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" [[package]] name = "bitreq" -version = "0.2.0" +version = "0.3.0" dependencies = [ "base64 0.22.1", "log", diff --git a/Cargo-recent.lock b/Cargo-recent.lock index 8736fd96..6a2af939 100644 --- a/Cargo-recent.lock +++ b/Cargo-recent.lock @@ -141,7 +141,7 @@ checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" [[package]] name = "bitreq" -version = "0.2.0" +version = "0.3.0" dependencies = [ "base64 0.22.1", "log", diff --git a/bitreq/Cargo.toml b/bitreq/Cargo.toml index e978e975..abff5663 100644 --- a/bitreq/Cargo.toml +++ b/bitreq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bitreq" -version = "0.2.0" +version = "0.3.0" authors = ["Jens Pitkanen ", "Tobin C. Harding "] description = "Simple, minimal-dependency HTTP client" documentation = "https://docs.rs/bitreq" diff --git a/jsonrpc/Cargo.toml b/jsonrpc/Cargo.toml index 3778fe18..7c06709e 100644 --- a/jsonrpc/Cargo.toml +++ b/jsonrpc/Cargo.toml @@ -34,7 +34,7 @@ serde = { version = "1", features = ["derive"] } serde_json = { version = "1", features = [ "raw_value" ] } base64 = { version = "0.22.1", optional = true } -bitreq = { version = "0.2.0", path = "../bitreq", features = ["json-using-serde"], optional = true } +bitreq = { version = "0.3.0", path = "../bitreq", features = ["json-using-serde"], optional = true } socks = { version = "0.3.4", optional = true} [lints.rust] diff --git a/node/Cargo.toml b/node/Cargo.toml index 99ed032e..01f68756 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -27,7 +27,7 @@ env_logger = { version = "0.9.3", default-features = false } anyhow = { version = "1.0.66", optional = true } bitcoin_hashes = { version = ">= 0.13, <= 0.14", optional = true } flate2 = { version = "1.0", optional = true } -bitreq = { version = "0.2.0", path = "../bitreq", features = ["https"], optional = true } +bitreq = { version = "0.3.0", path = "../bitreq", features = ["https"], optional = true } tar = { version = "0.4", optional = true } zip = { version = "0.6.6", default-features = false, features = ["bzip2", "deflate"], optional = true } From b9db6143412c267c3c9ba43edd2fc7ebd635a429 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 16 Jan 2026 00:16:34 +0000 Subject: [PATCH 5/5] [bitreq] Add a changelog entry for 0.3 ... in Australian time --- bitreq/CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bitreq/CHANGELOG.md b/bitreq/CHANGELOG.md index a823071b..9c35615f 100644 --- a/bitreq/CHANGELOG.md +++ b/bitreq/CHANGELOG.md @@ -1,3 +1,13 @@ +# 0.3.0 - 2026-01-16 + +* Fix a denial-of-service issue due to lack of bounding in response size [#452](https://github.com/rust-bitcoin/corepc/pull/452) +* Add support for `native-tls` in addition to `rustls` [#451](https://github.com/rust-bitcoin/corepc/pull/451) +* Support connection reuse via a `Client` object [#450](https://github.com/rust-bitcoin/corepc/pull/450) +* Make `async` native async rather than spawning a blocking task [#448](https://github.com/rust-bitcoin/corepc/pull/448) +* Remove `urlencoding` dependence [#424](https://github.com/rust-bitcoin/corepc/pull/424) +* Remove `punycode` dependency [#423](https://github.com/rust-bitcoin/corepc/pull/423) +* Remove unused `tokio` features [#421](https://github.com/rust-bitcoin/corepc/pull/421) + # 0.2.0 - 2025-10-31 * Re-implement `json-using-serde` feature [#398](https://github.com/rust-bitcoin/corepc/pull/398)