Patch-Source: https://github.com/ramsayleung/rspotify/pull/471 (backported)
--
From 2caa813b5c78d148fd23dfb19536100b4f22efc7 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 31 Mar 2024 20:16:23 +0200
Subject: [PATCH] Fix ureq-native-tls feature to actually use native-tls

ureq-native-tls currently doesn't work because ureq requires the TLS
connector to be specified explicitly for native-tls:

> `native-tls` enables an adapter so you can pass a
> `native_tls::TlsConnector` instance to `AgentBuilder::tls_connector`.
> Due to the risk of diamond dependencies accidentally switching on an
> unwanted TLS implementation, `native-tls` is never picked up as a
> default or used by the crate level convenience calls (`ureq::get`
> etc) – it must be configured on the agent.
> -- https://github.com/algesten/ureq#features

When ncspot is built with rspotify with ureq-native-tls, it's unable to
create an HTTPS connection:

    [ncspot::spotify_api] [DEBUG] http error: Transport(Transport { kind: UnknownScheme, message: Some("cannot make HTTPS request because no TLS backend is configured"), url: Some(Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("api.spotify.com")), port: None, path: "/v1/me/", query: None, fragment: None }), source: None })

--- a/vendor/rspotify/rspotify-http/Cargo.toml
+++ b/vendor/rspotify/rspotify-http/Cargo.toml
@@ -26,6 +26,7 @@
 # Supported clients
 reqwest = { version = "0.11.4", default-features = false, features = ["json", "socks"], optional = true }
 ureq = { version = "2.2.0", default-features = false, features = ["json", "cookies"], optional = true }
+native-tls = { version = "0.2.11", optional = true }
 
 [dev-dependencies]
 tokio = { version = "1.11.0", features = ["macros", "rt-multi-thread"] }
@@ -47,7 +48,7 @@
 # Same for ureq.
 ureq-rustls-tls = ["ureq/tls"]
 ureq-rustls-tls-native-certs = ["ureq/tls", "ureq/native-certs"]
-ureq-native-tls = ["ureq/native-tls"]
+ureq-native-tls = ["ureq/native-tls", "dep:native-tls"]
 
 # Internal features for checking async or sync compilation
 __async = ["async-trait"]
--- a/vendor/rspotify/rspotify-http/src/ureq.rs
+++ b/vendor/rspotify/rspotify-http/src/ureq.rs
@@ -58,9 +58,16 @@
 impl Default for UreqClient {
     fn default() -> Self {
         let agent = ureq::AgentBuilder::new()
-            .timeout(Duration::from_secs(10))
-            .build();
-        Self { agent }
+            .timeout(Duration::from_secs(10));
+
+        #[cfg(feature = "ureq-native-tls")]
+        let agent = agent.tls_connector(std::sync::Arc::new(
+            native_tls::TlsConnector::new().expect("Failed to initialize TLS connector"),
+        ));
+
+        Self {
+            agent: agent.build(),
+        }
     }
 }
 
