Skip to content

Commit cb6f9c6

Browse files
Shivam60Copilot
andcommitted
rust: use native-tls for the build-time CLI download
build.rs downloads the Copilot CLI with ureq, which was on the rustls (tls) feature and pulled rustls, ring and webpki-roots into the build. Switch ureq to native-tls and build the connector in build.rs so the build no longer compiles rustls/ring (schannel on Windows, Security.framework on macOS, OpenSSL on Linux). ring is still in Cargo.lock: reqwest declares hyper-rustls as an optional dependency and cargo keeps optional deps locked even when they are off, so cargo tree -i ring is empty but the lock entry stays. This drops ring from the build graph, not from the lockfile. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 991f7ab commit cb6f9c6

3 files changed

Lines changed: 9 additions & 24 deletions

File tree

rust/Cargo.lock

Lines changed: 2 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,6 @@ dirs = "5"
9393
flate2 = "1"
9494
sha2 = "0.10"
9595
tar = "0.4"
96-
ureq = { version = "2", default-features = false, features = ["tls"] }
96+
ureq = { version = "2", default-features = false, features = ["native-tls"] }
97+
native-tls = "0.2"
9798
zip = { version = "2", default-features = false, features = ["deflate"] }

rust/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,12 @@ struct DownloadError {
596596
}
597597

598598
fn try_download(url: &str) -> Result<Vec<u8>, DownloadError> {
599+
let connector = native_tls::TlsConnector::new().map_err(|e| DownloadError {
600+
message: format!("native-tls init error: {e}"),
601+
transient: false,
602+
})?;
599603
let agent = ureq::AgentBuilder::new()
604+
.tls_connector(std::sync::Arc::new(connector))
600605
.timeout_connect(Duration::from_secs(30))
601606
.timeout_read(Duration::from_secs(120))
602607
.build();

0 commit comments

Comments
 (0)