diff --git a/Cargo.lock b/Cargo.lock index 99609df9c..ee410500b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -247,9 +247,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.59+curl-7.86.0" +version = "0.4.60+curl-7.88.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cfce34829f448b08f55b7db6d0009e23e2e86a34e8c2b366269bf5799b4a407" +checksum = "717abe2cb465a5da6ce06617388a3980c9a2844196734bec8ccb8e575250f13f" dependencies = [ "cc", "libc", @@ -504,6 +504,7 @@ dependencies = [ "clap", "colored", "curl", + "curl-sys", "encoding", "float-cmp", "glob", diff --git a/bin/update_crates.sh b/bin/update_crates.sh index f35f321f2..d308b2fc7 100755 --- a/bin/update_crates.sh +++ b/bin/update_crates.sh @@ -47,7 +47,7 @@ get_crate_latest_version() { # get crate latest version crate_object=$(curl -kLs "${crate_url}" || true) crate_max_stable_version=$(echo "${crate_object}" | (jq -r .crate.max_stable_version 2>/dev/null || true)) - last_version=$(echo "${crate_max_stable_version}" | (grep --extended-regexp "^[0-9].*.[0-9].*.[0-9]$" || true)) + last_version=$(echo "${crate_max_stable_version}" | (grep --extended-regexp --only-matching "^[0-9]*\.[0-9]*\.[0-9]*" || true)) echo "${last_version}" } diff --git a/packages/hurl/Cargo.toml b/packages/hurl/Cargo.toml index 293bcb908..0f5b1c266 100644 --- a/packages/hurl/Cargo.toml +++ b/packages/hurl/Cargo.toml @@ -24,6 +24,7 @@ chrono = { version = "0.4.23", default-features = false, features = ["clock"] } clap = { version = "4.1.6", features = ["cargo", "string", "wrap_help"] } colored = "2.0.0" curl = "0.4.44" +curl-sys = "0.4.60" encoding = "0.2.33" float-cmp = "0.9.0" glob = "0.3.1" diff --git a/packages/hurl/tests/libcurl.rs b/packages/hurl/tests/libcurl.rs index fa94970ac..d2a4b0c1e 100644 --- a/packages/hurl/tests/libcurl.rs +++ b/packages/hurl/tests/libcurl.rs @@ -16,6 +16,7 @@ * */ +use regex::Regex; use std::default::Default; use std::time::Duration; @@ -846,14 +847,17 @@ fn test_connect_timeout() { { eprintln!("description={description}"); // TODO: remove the 7 / "Couldn't connect to server" case - // On Linux/Windows libcurl version, the correct error message - // is 28 / "Connection timeout" | "Connection timed out" - // On macOS <= 11.6.4, the built-in libcurl use - // 7 / "Couldn't connect to server" errors. On the GitHub CI, macOS images are 11.6.4. + // On Linux/Windows libcurl version, the correct error message is: + // `CURLE_OPERATION_TIMEDOUT` (28) / "Connection timeout" | "Connection timed out" + // On macOS <= 11.6.4, the built-in libcurl is: + // `CURLE_COULDNT_CONNECT` (7) / "Couldn't connect to server" errors. + // On the GitHub CI, macOS images are 11.6.4. // So we keep this code until a newer macOS image is used in the GitHub actions. assert!(code == 7 || code == 28); + let re = Regex::new(r"^Failed to connect to.*: Timeout was reached$").unwrap(); assert!( - description.starts_with("Couldn't connect to server") + re.is_match(&description) + || description.starts_with("Couldn't connect to server") || description.starts_with("Connection timed out") || description.starts_with("Connection timeout") );