Skip to content

Commit

Permalink
Use reqwest instead of ureq and hyper.
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat committed Sep 27, 2024
1 parent c8c3871 commit 2d1cc7f
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 100 deletions.
93 changes: 64 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ termcolor_output = "1.0.1"
ed25519-dalek = ">= 2.1.1"

# networking
http = "1.0.0"
jsonrpsee-http-client = "0.20.1"
jsonrpsee-core = "0.20.1"
tokio = "1.28.1"
Expand Down
10 changes: 3 additions & 7 deletions cmd/soroban-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,10 @@ wasmparser = { workspace = true }
sha2 = { workspace = true }
csv = "1.1.6"
ed25519-dalek = { workspace = true }
reqwest = { version = "0.12.7", features = ["json", "blocking", "stream"] }
jsonrpsee-http-client = "0.20.1"
jsonrpsee-core = "0.20.1"
hyper = "0.14.27"
hyper-tls = "0.5"
http = "0.2.9"
http = "1.1.0"
regex = "1.6.0"
wasm-opt = { version = "0.114.0", optional = true }
chrono = { version = "0.4.27", features = ["serde"]}
Expand Down Expand Up @@ -107,7 +106,6 @@ gix = { version = "0.58.0", default-features = false, features = [
"blocking-http-transport-reqwest-rust-tls",
"worktree-mutation",
] }
ureq = { version = "2.9.1", features = ["json"] }
async-compression = { version = "0.4.12", features = [ "tokio", "gzip" ] }

tempfile = "3.8.1"
Expand All @@ -126,15 +124,13 @@ glob = "0.3.1"
open = "5.3.0"
url = "2.5.2"

# For hyper-tls
[target.'cfg(unix)'.dependencies]
openssl = { version = "=0.10.55", features = ["vendored"] }
reqwest = { version = "0.12.7", features = ["json", "blocking", "stream", "native-tls-vendored"] }

[build-dependencies]
crate-git-revision = "0.0.4"
serde.workspace = true
thiserror.workspace = true
ureq = { version = "2.9.1", features = ["json"] }


[dev-dependencies]
Expand Down
5 changes: 2 additions & 3 deletions cmd/soroban-cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use clap::CommandFactory;
use dotenvy::dotenv;
use std::thread;
use tracing_subscriber::{fmt, EnvFilter};

use crate::upgrade_check::upgrade_check;
Expand Down Expand Up @@ -75,8 +74,8 @@ pub async fn main() {
// Spawn a thread to check if a new version exists.
// It depends on logger, so we need to place it after
// the code block that initializes the logger.
thread::spawn(move || {
upgrade_check(root.global_args.quiet);
tokio::spawn(async move {
upgrade_check(root.global_args.quiet).await;
});

let printer = print::Print::new(root.global_args.quiet);
Expand Down
3 changes: 1 addition & 2 deletions cmd/soroban-cli/src/commands/contract/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use std::{
sync::atomic::AtomicBool,
};
use toml_edit::{Document, TomlError};
use ureq::get;

use crate::{commands::global, print};

Expand Down Expand Up @@ -261,7 +260,7 @@ impl Runner {
}

fn check_internet_connection() -> bool {
if let Ok(_req) = get(GITHUB_URL).call() {
if let Ok(_req) = reqwest::blocking::get(GITHUB_URL) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub enum Error {
#[error(transparent)]
Rpc(#[from] rpc::Error),
#[error(transparent)]
Hyper(#[from] hyper::Error),
HttpClient(#[from] reqwest::Error),
#[error("Failed to parse JSON from {0}, {1}")]
FailedToParseJSON(String, serde_json::Error),
#[error("Invalid URL {0}")]
Expand Down
Loading

0 comments on commit 2d1cc7f

Please sign in to comment.