Skip to content

Commit e9d7827

Browse files
committed
Merge #399: jsonrpc: Depend on bitreq
4ef980d Depend on bitreq (Tobin C. Harding) 1998fed Fix stale fuzz target name (Tobin C. Harding) fa402e9 Remove mention of minreq from rustdoc (Tobin C. Harding) 5b8b8cc bitreq: Fix stale crate docs heading (Tobin C. Harding) 6098528 bitreq: Rename MINREQ_TIMEOUT to BITREQ_TIMEOUT (Tobin C. Harding) Pull request description: We just forked `minreq` into this repository to create an HTTP crate that is specifically designed to be used by Bitcoin projects. As such we called it `bitreq`. Depend on the local `bitreq` crate instead of `minreq`. ACKs for top commit: jamillambert: ACK 4ef980d Tree-SHA512: 170e745be5fb7f611f0e539d3f03e277a559895bd1d31d5a8f4178c6d5a2e56aa0c632a2dcbec5a5efff32987ec25a4f93616f42d997586afe0f503a84283647
2 parents fa99e0e + 4ef980d commit e9d7827

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+116
-146
lines changed

.github/workflows/cron-daily-fuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
# We only get 20 jobs at a time, we probably don't want to go
1919
# over that limit with fuzzing because of the hour run time.
2020
fuzz_target: [
21-
minreq_http,
21+
bitreq_http,
2222
simple_http,
2323
]
2424
steps:

Cargo-minimal.lock

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ version = "0.10.0"
281281
dependencies = [
282282
"anyhow",
283283
"bitcoin_hashes",
284+
"bitreq",
284285
"corepc-client",
285286
"env_logger",
286287
"flate2",
287288
"log",
288-
"minreq",
289289
"serde_json",
290290
"tar",
291291
"tempfile",
@@ -453,7 +453,7 @@ name = "jsonrpc"
453453
version = "0.18.0"
454454
dependencies = [
455455
"base64 0.22.1",
456-
"minreq",
456+
"bitreq",
457457
"serde",
458458
"serde_json",
459459
"socks",
@@ -503,21 +503,6 @@ dependencies = [
503503
"adler2",
504504
]
505505

506-
[[package]]
507-
name = "minreq"
508-
version = "2.11.2"
509-
source = "registry+https://github.com/rust-lang/crates.io-index"
510-
checksum = "6fdef521c74c2884a4f3570bcdb6d2a77b3c533feb6b27ac2ae72673cc221c64"
511-
dependencies = [
512-
"log",
513-
"once_cell",
514-
"rustls",
515-
"rustls-webpki",
516-
"serde",
517-
"serde_json",
518-
"webpki-roots",
519-
]
520-
521506
[[package]]
522507
name = "mio"
523508
version = "1.0.2"

Cargo-recent.lock

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ version = "0.10.0"
281281
dependencies = [
282282
"anyhow",
283283
"bitcoin_hashes",
284+
"bitreq",
284285
"corepc-client",
285286
"env_logger",
286287
"flate2",
287288
"log",
288-
"minreq",
289289
"serde_json",
290290
"tar",
291291
"tempfile",
@@ -458,7 +458,7 @@ name = "jsonrpc"
458458
version = "0.18.0"
459459
dependencies = [
460460
"base64 0.22.1",
461-
"minreq",
461+
"bitreq",
462462
"serde",
463463
"serde_json",
464464
"socks",
@@ -508,21 +508,6 @@ dependencies = [
508508
"adler2",
509509
]
510510

511-
[[package]]
512-
name = "minreq"
513-
version = "2.13.2"
514-
source = "registry+https://github.com/rust-lang/crates.io-index"
515-
checksum = "da0c420feb01b9fb5061f8c8f452534361dd783756dcf38ec45191ce55e7a161"
516-
dependencies = [
517-
"log",
518-
"once_cell",
519-
"rustls",
520-
"rustls-webpki",
521-
"serde",
522-
"serde_json",
523-
"webpki-roots",
524-
]
525-
526511
[[package]]
527512
name = "mio"
528513
version = "1.1.0"

bitreq/src/connection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub struct AsyncConnection {
8787
impl AsyncConnection {
8888
/// Creates a new `AsyncConnection`.
8989
pub(crate) fn new(request: ParsedRequest) -> AsyncConnection {
90-
let timeout = request.config.timeout.or_else(|| match env::var("MINREQ_TIMEOUT") {
90+
let timeout = request.config.timeout.or_else(|| match env::var("BITREQ_TIMEOUT") {
9191
Ok(t) => t.parse::<u64>().ok(),
9292
Err(_) => None,
9393
});
@@ -128,7 +128,7 @@ impl Connection {
128128
/// Creates a new `Connection`. See [Request] and [ParsedRequest]
129129
/// for specifics about *what* is being sent.
130130
pub(crate) fn new(request: ParsedRequest) -> Connection {
131-
let timeout = request.config.timeout.or_else(|| match env::var("MINREQ_TIMEOUT") {
131+
let timeout = request.config.timeout.or_else(|| match env::var("BITREQ_TIMEOUT") {
132132
Ok(t) => t.parse::<u64>().ok(),
133133
Err(_) => None,
134134
});

bitreq/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! # Minreq
1+
//! # Bitreq
22
//!
33
//! Simple, minimal-dependency HTTP client. The library has a very
44
//! minimal API, so you'll probably know everything you need to after
@@ -207,16 +207,16 @@
207207
//! ```text,ignore
208208
//! bitreq::get("/").with_timeout(8).send();
209209
//! ```
210-
//! - Set the environment variable `MINREQ_TIMEOUT` to the desired
210+
//! - Set the environment variable `BITREQ_TIMEOUT` to the desired
211211
//! amount of seconds until timeout. Ie. if you have a program called
212212
//! `foo` that uses bitreq, and you want all the requests made by that
213213
//! program to timeout in 8 seconds, you launch the program like so:
214214
//! ```text,ignore
215-
//! $ MINREQ_TIMEOUT=8 ./foo
215+
//! $ BITREQ_TIMEOUT=8 ./foo
216216
//! ```
217217
//! Or add the following somewhere before the requests in the code.
218218
//! ```
219-
//! std::env::set_var("MINREQ_TIMEOUT", "8");
219+
//! std::env::set_var("BITREQ_TIMEOUT", "8");
220220
//! ```
221221
//! If the timeout is set with `with_timeout`, the environment
222222
//! variable will be ignored.

client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ serde = { version = "1.0.103", default-features = false, features = [ "derive",
2727
serde_json = { version = "1.0.117" }
2828
types = { package = "corepc-types", version = "0.10.0", path = "../types", default-features = false, features = ["std"] }
2929

30-
jsonrpc = { version = "0.18.0", path = "../jsonrpc", features = ["minreq_http"], optional = true }
30+
jsonrpc = { version = "0.18.0", path = "../jsonrpc", features = ["bitreq_http"], optional = true }
3131

3232
[dev-dependencies]

client/src/client_sync/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ impl Auth {
5555
}
5656
}
5757

58-
/// Defines a `jsonrpc::Client` using `minreq`.
58+
/// Defines a `jsonrpc::Client` using `bitreq`.
5959
#[macro_export]
60-
macro_rules! define_jsonrpc_minreq_client {
60+
macro_rules! define_jsonrpc_bitreq_client {
6161
($version:literal) => {
6262
use std::fmt;
6363

@@ -81,7 +81,7 @@ macro_rules! define_jsonrpc_minreq_client {
8181
impl Client {
8282
/// Creates a client to a bitcoind JSON-RPC server without authentication.
8383
pub fn new(url: &str) -> Self {
84-
let transport = jsonrpc::http::minreq_http::Builder::new()
84+
let transport = jsonrpc::http::bitreq_http::Builder::new()
8585
.url(url)
8686
.expect("jsonrpc v0.18, this function does not error")
8787
.timeout(std::time::Duration::from_secs(60))
@@ -98,7 +98,7 @@ macro_rules! define_jsonrpc_minreq_client {
9898
}
9999
let (user, pass) = auth.get_user_pass()?;
100100

101-
let transport = jsonrpc::http::minreq_http::Builder::new()
101+
let transport = jsonrpc::http::bitreq_http::Builder::new()
102102
.url(url)
103103
.expect("jsonrpc v0.18, this function does not error")
104104
.timeout(std::time::Duration::from_secs(60))

client/src/client_sync/v17/blockchain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! All macros require `Client` to be in scope.
99
//!
10-
//! See or use the `define_jsonrpc_minreq_client!` macro to define a `Client`.
10+
//! See or use the `define_jsonrpc_bitreq_client!` macro to define a `Client`.
1111
1212
/// Implements Bitcoin Core JSON-RPC API method `getblockchaininfo`.
1313
#[macro_export]

client/src/client_sync/v17/control.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! All macros require `Client` to be in scope.
99
//!
10-
//! See or use the `define_jsonrpc_minreq_client!` macro to define a `Client`.
10+
//! See or use the `define_jsonrpc_bitreq_client!` macro to define a `Client`.
1111
1212
/// Implements Bitcoin Core JSON-RPC API method `getmemoryinfo`.
1313
#[macro_export]

client/src/client_sync/v17/generating.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! All macros require `Client` to be in scope.
99
//!
10-
//! See or use the `define_jsonrpc_minreq_client!` macro to define a `Client`.
10+
//! See or use the `define_jsonrpc_bitreq_client!` macro to define a `Client`.
1111
1212
/// Implements Bitcoin Core JSON-RPC API method `generatetoaddress`.
1313
#[macro_export]

0 commit comments

Comments
 (0)