remote_server: Remove dependency on libssl and libcrypto (#15446)

Fixes: #15599
Release Notes:

- N/A

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Conrad <conrad@zed.dev>
This commit is contained in:
Piotr Osiewicz 2024-09-18 23:29:34 +02:00 committed by GitHub
parent 9016de5d63
commit 2c8a6ee7cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 670 additions and 226 deletions

View file

@ -117,7 +117,7 @@ impl App {
Self(AppContext::new(
current_platform(false),
Arc::new(()),
http_client::client(None, None),
Arc::new(NullHttpClient),
))
}
@ -128,7 +128,7 @@ impl App {
Self(AppContext::new(
current_platform(true),
Arc::new(()),
http_client::client(None, None),
Arc::new(NullHttpClient),
))
}
@ -142,6 +142,14 @@ impl App {
self
}
/// Set the http client for the application
pub fn with_http_client(self, http_client: Arc<dyn HttpClient>) -> Self {
let mut context_lock = self.0.borrow_mut();
context_lock.http_client = http_client;
drop(context_lock);
self
}
/// Start the application. The provided callback will be called once the
/// app is fully launched.
pub fn run<F>(self, on_finish_launching: F)
@ -1512,3 +1520,22 @@ pub struct KeystrokeEvent {
/// The action that was resolved for the keystroke, if any
pub action: Option<Box<dyn Action>>,
}
struct NullHttpClient;
impl HttpClient for NullHttpClient {
fn send_with_redirect_policy(
&self,
_req: http_client::Request<http_client::AsyncBody>,
_follow_redirects: bool,
) -> futures::future::BoxFuture<
'static,
Result<http_client::Response<http_client::AsyncBody>, anyhow::Error>,
> {
async move { Err(anyhow!("No HttpClient available")) }.boxed()
}
fn proxy(&self) -> Option<&http_client::Uri> {
None
}
}