Skip to content

Commit

Permalink
Use reqwest, remove http, ureq and hyper (#1632)
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat authored Oct 3, 2024
1 parent ddad905 commit 2cb77d2
Show file tree
Hide file tree
Showing 11 changed files with 275 additions and 152 deletions.
87 changes: 53 additions & 34 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
23 changes: 11 additions & 12 deletions cmd/soroban-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,18 @@ wasmparser = { workspace = true }
sha2 = { workspace = true }
csv = "1.1.6"
ed25519-dalek = { workspace = true }
reqwest = { version = "0.12.7", default-features = false, features = [
"rustls-tls",
"http2",
"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"
regex = "1.6.0"
wasm-opt = { version = "0.114.0", optional = true }
chrono = { version = "0.4.27", features = ["serde"]}
chrono = { version = "0.4.27", features = ["serde"] }
rpassword = "7.2.0"
dirs = "4.0.0"
toml = "0.5.9"
Expand All @@ -107,13 +111,12 @@ 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" ] }
async-compression = { version = "0.4.12", features = ["tokio", "gzip"] }

tempfile = "3.8.1"
toml_edit = "0.21.0"
rust-embed = { version = "8.2.0", features = ["debug-embed"] }
bollard = { workspace=true }
bollard = { workspace = true }
futures-util = "0.3.30"
futures = "0.3.30"
home = "0.5.9"
Expand All @@ -127,19 +130,15 @@ fqdn = "0.3.12"
open = "5.3.0"
url = "2.5.2"

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

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


[dev-dependencies]
assert_cmd = "2.0.4"
assert_fs = "1.0.7"
predicates = "2.1.5"
walkdir = "2.5.0"
mockito = "1.5.0"
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
4 changes: 2 additions & 2 deletions cmd/soroban-cli/src/commands/contract/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use std::{
sync::atomic::AtomicBool,
};
use toml_edit::{Document, TomlError};
use ureq::get;

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

const SOROBAN_EXAMPLES_URL: &str = "https://github.com/stellar/soroban-examples.git";
Expand Down Expand Up @@ -261,7 +261,7 @@ impl Runner {
}

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

Expand Down
4 changes: 1 addition & 3 deletions cmd/soroban-cli/src/commands/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@ pub enum Error {
#[error("network arg or rpc url and network passphrase are required if using the network")]
Network,
#[error(transparent)]
Http(#[from] http::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 2cb77d2

Please sign in to comment.