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/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) 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/bitreq/src/error.rs b/bitreq/src/error.rs index 56f39a38..9eb4346d 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. @@ -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 1c07374b..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: /// @@ -49,16 +49,16 @@ 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 /// /// ``` - /// 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); } } 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 }