Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo-minimal.lock
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"

[[package]]
name = "bitreq"
version = "0.2.0"
version = "0.3.0"
dependencies = [
"base64 0.22.1",
"log",
Expand Down
2 changes: 1 addition & 1 deletion Cargo-recent.lock
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"

[[package]]
name = "bitreq"
version = "0.2.0"
version = "0.3.0"
dependencies = [
"base64 0.22.1",
"log",
Expand Down
10 changes: 10 additions & 0 deletions bitreq/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion bitreq/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bitreq"
version = "0.2.0"
version = "0.3.0"
authors = ["Jens Pitkanen <jens@neon.moe>", "Tobin C. Harding <me@tobin.cc>"]
description = "Simple, minimal-dependency HTTP client"
documentation = "https://docs.rs/bitreq"
Expand Down
4 changes: 2 additions & 2 deletions bitreq/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion bitreq/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! #[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()?;
Expand Down
12 changes: 6 additions & 6 deletions bitreq/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@ impl Proxy {
}
}

/// Creates a new Proxy configuration.
/// Creates a new Proxy configuration for an HTTP proxy supporting the `CONNECT` command.
///
/// Supported proxy format is:
///
/// ```plaintext
/// [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<S: AsRef<str>>(proxy: S) -> Result<Self, Error> {
pub fn new_http<S: AsRef<str>>(proxy: S) -> Result<Self, Error> {
let proxy = proxy.as_ref();
let authority = if let Some((proto, auth)) = split_once(proxy, "://") {
if proto != "http" {
Expand Down Expand Up @@ -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"));
Expand All @@ -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"));
Expand Down
6 changes: 3 additions & 3 deletions bitreq/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,22 +393,22 @@ 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);
}
}
// Set any given proxies if neither of HTTP/HTTPS were given
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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion jsonrpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down