Skip to content
This repository was archived by the owner on Sep 21, 2024. It is now read-only.

Commit f0f116c

Browse files
authored
chore: Upgrade reqwest to 0.12, without macos-system-configuration. Fixes #686 (#866)
1 parent b254c70 commit f0f116c

File tree

9 files changed

+91
-86
lines changed

9 files changed

+91
-86
lines changed

Cargo.lock

+74-38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ libipld-cbor = { version = "0.16" }
6060
libipld-json = { version = "0.16" }
6161
pathdiff = { version = "0.2.1" }
6262
rand = { version = "0.8" }
63-
reqwest = { version = "=0.11.20", default-features = false, features = ["json", "rustls-tls", "stream"] }
63+
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "stream"] }
6464
sentry-tracing = { version = "0.31.8" }
6565
serde = { version = "^1" }
6666
serde_json = { version = "^1" }
@@ -88,7 +88,7 @@ void = { version = "1" }
8888
wasm-bindgen = { version = "^0.2" }
8989
wasm-bindgen-test = { version = "^0.3" }
9090
wasm-bindgen-futures = { version = "^0.4" }
91-
wasm-streams = { version = "0.3.0" }
91+
wasm-streams = { version = "0.4" }
9292
web-sys = { version = "0.3" }
9393

9494
[profile.release]

rust/noosphere-cli/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ observability = ["noosphere-gateway/observability"]
2828
vergen = { workspace = true }
2929

3030
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
31-
reqwest = { version = "~0.11", default-features = false, features = ["json", "rustls-tls", "stream"] }
31+
reqwest = { workspace = true, default-features = false, features = ["json", "rustls-tls", "stream"] }
3232

3333
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
3434
tempfile = { workspace = true }

rust/noosphere-core/src/api/client.rs

+7-29
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
use std::str::FromStr;
2-
31
use crate::{
4-
api::{route::RouteUrl, v0alpha1, v0alpha2, StatusCode},
2+
api::{route::RouteUrl, v0alpha1, v0alpha2},
3+
authority::{generate_capability, Author, SphereAbility, SphereReference},
4+
data::{Link, MemoIpld},
55
error::NoosphereError,
66
stream::{from_car_stream, memo_history_stream, put_block_stream, to_car_stream},
77
};
88
use anyhow::{anyhow, Result};
99
use async_stream::try_stream;
1010
use bytes::Bytes;
1111
use cid::Cid;
12+
use http::StatusCode;
1213
use iroh_car::CarReader;
1314
use libipld_cbor::DagCborCodec;
1415
use noosphere_common::{ConditionalSend, ConditionalSync, UnsharedStream};
15-
16-
use crate::{
17-
authority::{generate_capability, Author, SphereAbility, SphereReference},
18-
data::{Link, MemoIpld},
19-
};
2016
use noosphere_storage::{block_deserialize, block_serialize, BlockStore};
2117
use noosphere_ucan::{
2218
builder::UcanBuilder,
@@ -26,6 +22,7 @@ use noosphere_ucan::{
2622
ucan::Ucan,
2723
};
2824
use reqwest::header::HeaderMap;
25+
use std::str::FromStr;
2926
use tokio_stream::{Stream, StreamExt};
3027
use tokio_util::io::StreamReader;
3128
use url::Url;
@@ -93,7 +90,7 @@ where
9390
client.get(url).send().await?
9491
};
9592

96-
match translate_status_code(did_response.status())? {
93+
match did_response.status() {
9794
StatusCode::OK => (),
9895
_ => return Err(anyhow!("Unable to look up gateway identity")),
9996
};
@@ -475,7 +472,7 @@ where
475472
v0alpha2::PushError::BrokenUpstream
476473
})?;
477474

478-
let status = translate_status_code(response.status())?;
475+
let status = response.status();
479476
trace!("Checking response ({})...", status);
480477

481478
if status == StatusCode::CONFLICT {
@@ -531,22 +528,3 @@ where
531528
Ok(push_response)
532529
}
533530
}
534-
535-
/// Both `reqwest` and `axum` re-export `StatusCode` from the `http` crate.
536-
///
537-
/// We're stuck on [email protected] [1] that uses an older version
538-
/// of `http::StatusCode`, whereas axum >= 0.7 uses the 1.0 release
539-
/// of several HTTP libraries (`http`, `http-body`, `hyper`) [2], which
540-
/// we'd like to use as our canonical representation.
541-
///
542-
/// This utility converts between the old `reqwest::StatusCode` to the
543-
/// >=1.0 implementation. Notably, we do not pull in all of `axum`
544-
/// into the `noosphere-core` crate, only the common underlying
545-
/// crate `[email protected]` (or greater).
546-
///
547-
/// [1] https://github.com/subconsciousnetwork/noosphere/issues/686
548-
/// [2] https://github.com/tokio-rs/axum/blob/5b6204168a676497d2f4188af603546d9ebfe20a/axum/CHANGELOG.md#070-27-november-2023
549-
fn translate_status_code(reqwest_code: reqwest::StatusCode) -> Result<StatusCode> {
550-
let code: u16 = reqwest_code.into();
551-
Ok(code.try_into()?)
552-
}

rust/noosphere-core/src/api/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,3 @@ pub mod v0alpha2;
1111

1212
pub use client::*;
1313
pub use data::*;
14-
15-
// Re-export `http::StatusCode` here as our preferred `StatusCode` instance,
16-
// disambiguating from other crate's implementations.
17-
pub(crate) use http::StatusCode;

0 commit comments

Comments
 (0)