diff --git a/Cargo.lock b/Cargo.lock index 530980d..99e0ee2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -580,7 +580,7 @@ dependencies = [ "http 0.2.12", "indexmap 2.2.6", "slab", - "tokio 1.39.1", + "tokio 1.40.0", "tokio-util 0.7.11", "tracing", ] @@ -599,7 +599,7 @@ dependencies = [ "http 1.1.0", "indexmap 2.2.6", "slab", - "tokio 1.39.1", + "tokio 1.40.0", "tokio-util 0.7.11", "tracing", ] @@ -763,7 +763,7 @@ dependencies = [ "httpdate 1.0.3", "itoa 1.0.11", "pin-project-lite 0.2.14", - "tokio 1.39.1", + "tokio 1.40.0", "tower-service", "tracing", "want", @@ -785,7 +785,7 @@ dependencies = [ "itoa 1.0.11", "pin-project-lite 0.2.14", "smallvec", - "tokio 1.39.1", + "tokio 1.40.0", "want", ] @@ -800,8 +800,9 @@ dependencies = [ "hyper 1.4.1", "hyper-util", "rustls", + "rustls-native-certs", "rustls-pki-types", - "tokio 1.39.1", + "tokio 1.40.0", "tokio-rustls", "tower-service", "webpki-roots", @@ -831,7 +832,7 @@ dependencies = [ "hyper 1.4.1", "hyper-util", "native-tls", - "tokio 1.39.1", + "tokio 1.40.0", "tokio-native-tls", "tower-service", ] @@ -850,7 +851,7 @@ dependencies = [ "hyper 1.4.1", "pin-project-lite 0.2.14", "socket2 0.5.7", - "tokio 1.39.1", + "tokio 1.40.0", "tower", "tower-service", "tracing", @@ -1144,7 +1145,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "similar", - "tokio 1.39.1", + "tokio 1.40.0", ] [[package]] @@ -1420,13 +1421,13 @@ dependencies = [ "openssl", "pyo3", "pyo3-log", - "reqwest 0.12.5", + "reqwest 0.12.7", "reqwest_mock", "serde", "serde_json", "state", "tempdir", - "tokio 1.39.1", + "tokio 1.40.0", "url", ] @@ -1518,7 +1519,7 @@ dependencies = [ "rustls", "socket2 0.5.7", "thiserror", - "tokio 1.39.1", + "tokio 1.40.0", "tracing", ] @@ -1743,14 +1744,14 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg 0.7.0", + "winreg", ] [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ "base64 0.22.1", "bytes 1.6.1", @@ -1775,6 +1776,7 @@ dependencies = [ "pin-project-lite 0.2.14", "quinn", "rustls", + "rustls-native-certs", "rustls-pemfile", "rustls-pki-types", "serde", @@ -1782,7 +1784,7 @@ dependencies = [ "serde_urlencoded", "sync_wrapper", "system-configuration", - "tokio 1.39.1", + "tokio 1.40.0", "tokio-native-tls", "tokio-rustls", "tower-service", @@ -1791,7 +1793,7 @@ dependencies = [ "wasm-bindgen-futures", "web-sys", "webpki-roots", - "winreg 0.52.0", + "windows-registry", ] [[package]] @@ -1854,9 +1856,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.12" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "once_cell", "ring", @@ -1866,6 +1868,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "2.1.2" @@ -1884,9 +1899,9 @@ checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" -version = "0.102.6" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -2010,6 +2025,15 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + [[package]] name = "similar" version = "2.6.0" @@ -2081,9 +2105,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.72" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -2095,23 +2119,26 @@ name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] [[package]] name = "system-configuration" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", @@ -2220,9 +2247,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.39.1" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d040ac2b29ab03b09d4129c2f5bbd012a3ac2f79d38ff506a4bf8dd34b0eac8a" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes 1.6.1", @@ -2230,10 +2257,23 @@ dependencies = [ "mio 1.0.1", "parking_lot", "pin-project-lite 0.2.14", + "signal-hook-registry", "socket2 0.5.7", + "tokio-macros", "windows-sys 0.52.0", ] +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tokio-native-tls" version = "0.3.1" @@ -2241,7 +2281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", - "tokio 1.39.1", + "tokio 1.40.0", ] [[package]] @@ -2252,7 +2292,7 @@ checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ "rustls", "rustls-pki-types", - "tokio 1.39.1", + "tokio 1.40.0", ] [[package]] @@ -2289,7 +2329,7 @@ dependencies = [ "futures-core", "futures-sink", "pin-project-lite 0.2.14", - "tokio 1.39.1", + "tokio 1.40.0", ] [[package]] @@ -2302,7 +2342,7 @@ dependencies = [ "futures-util", "pin-project", "pin-project-lite 0.2.14", - "tokio 1.39.1", + "tokio 1.40.0", "tower-layer", "tower-service", ] @@ -2652,6 +2692,36 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -2800,16 +2870,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if 1.0.0", - "windows-sys 0.48.0", -] - [[package]] name = "ws2_32-sys" version = "0.2.1" diff --git a/Cargo.toml b/Cargo.toml index 3d71389..83c0fab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,8 +19,8 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" chrono = { version = "0.4.38", features = ["serde"] } bincode = "1.3.3" -reqwest = { version = "0.12", features = ["json", "rustls-tls"] } -tokio = { version = "1.39", features = ["rt-multi-thread"] } +reqwest = { version = "0.12.7", features = ["json", "rustls-tls", "rustls-tls-native-roots"] } +tokio = { version = "1.40", features = ["rt-multi-thread", "full"] } url = { version = "2.5", features = [] } json = { version = "0.12" } state = { version = "0.6"} diff --git a/src/auth.rs b/src/auth.rs index 3bee228..40cddfa 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -6,6 +6,9 @@ use pyo3::import_exception; use pyo3::prelude::*; use pyo3::types::{PyDate, PyDateAccess, PyType}; use reqwest::Proxy; +// use reqwest_mock::config::ClientConfig; +// use rustls::{ClientConfig, RootCertStore}; +// use rustls_native_certs::load_native_certs; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::env; @@ -15,6 +18,8 @@ use std::io::prelude::*; use std::path::{Path, PathBuf}; use std::str::FromStr; //use std::dbg; +// use std::sync::Arc; +// use pyo3::prepare_freethreaded_python; use url::Url; #[allow(unused_imports)] @@ -286,8 +291,24 @@ impl Default for AuthToken { } fn build_client(proxies: &Option>) -> PyResult { + + // prepare_freethreaded_python(); + // let _ = rustls::crypto::ring::default_provider().install_default(); + // let mut root_store = RootCertStore::empty(); + // for cert in load_native_certs().expect("Could not load native certs") { + // root_store.add(cert).expect("Could not add cert to store"); + // } + + // let config = ClientConfig::builder() + // .with_root_certificates(root_store) + // .with_no_client_auth(); + + // println!("Proxies: {:?}", proxies); + client_builder_from_proxies(proxies.as_ref().unwrap_or(&HashMap::new())) .use_rustls_tls() + .tls_built_in_native_certs(true) + // .use_preconfigured_tls(Arc::new(config)) .build() .map_err(|err| CredentialError::new_err(format!("Error creating HTTP client: {}", err))) }