Remove useless Result, native_tls dependency
This commit is contained in:
parent
5e2f965058
commit
c0390aba0d
@ -22,7 +22,6 @@ ruma-api = "0.12.0"
|
|||||||
ruma-client-api = "0.5.0"
|
ruma-client-api = "0.5.0"
|
||||||
ruma-events = "0.15.1"
|
ruma-events = "0.15.1"
|
||||||
ruma-identifiers = "0.14.0"
|
ruma-identifiers = "0.14.0"
|
||||||
native-tls = { version = "0.2.3", optional = true }
|
|
||||||
serde = { version = "1.0.103", features = ["derive"] }
|
serde = { version = "1.0.103", features = ["derive"] }
|
||||||
serde_json = "1.0.44"
|
serde_json = "1.0.44"
|
||||||
serde_urlencoded = "0.6.1"
|
serde_urlencoded = "0.6.1"
|
||||||
@ -34,4 +33,4 @@ tokio = { version = "0.2.4", features = ["macros"] }
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["tls"]
|
default = ["tls"]
|
||||||
tls = ["hyper-tls", "native-tls"]
|
tls = ["hyper-tls"]
|
||||||
|
@ -100,8 +100,6 @@ use hyper::{
|
|||||||
};
|
};
|
||||||
#[cfg(feature = "hyper-tls")]
|
#[cfg(feature = "hyper-tls")]
|
||||||
use hyper_tls::HttpsConnector;
|
use hyper_tls::HttpsConnector;
|
||||||
#[cfg(feature = "hyper-tls")]
|
|
||||||
use native_tls::Error as NativeTlsError;
|
|
||||||
use ruma_api::{Endpoint, Outgoing};
|
use ruma_api::{Endpoint, Outgoing};
|
||||||
use tokio::io::{AsyncRead, AsyncWrite};
|
use tokio::io::{AsyncRead, AsyncWrite};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
@ -165,14 +163,14 @@ pub type HttpsClient = Client<HttpsConnector<HttpConnector>>;
|
|||||||
#[cfg(feature = "tls")]
|
#[cfg(feature = "tls")]
|
||||||
impl HttpsClient {
|
impl HttpsClient {
|
||||||
/// Creates a new client for making HTTPS requests to the given homeserver.
|
/// Creates a new client for making HTTPS requests to the given homeserver.
|
||||||
pub fn https(homeserver_url: Url, session: Option<Session>) -> Result<Self, NativeTlsError> {
|
pub fn https(homeserver_url: Url, session: Option<Session>) -> Self {
|
||||||
let connector = HttpsConnector::new();
|
let connector = HttpsConnector::new();
|
||||||
|
|
||||||
Ok(Self(Arc::new(ClientData {
|
Self(Arc::new(ClientData {
|
||||||
homeserver_url,
|
homeserver_url,
|
||||||
hyper: HyperClient::builder().keep_alive(true).build(connector),
|
hyper: HyperClient::builder().keep_alive(true).build(connector),
|
||||||
session: Mutex::new(session),
|
session: Mutex::new(session),
|
||||||
})))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user