put all TLS functionality behind a feature flag
The "Cargo feature" `default-tls`, which is enabled by default, is added, with all TLS support relying on it. This allows using reqwest but disabling the `native-tls` dependency, by disabling this feature. Closes #225
This commit is contained in:
		| @@ -135,6 +135,7 @@ impl Error { | ||||
|             Kind::Hyper(ref e) => Some(e), | ||||
|             Kind::Mime(ref e) => Some(e), | ||||
|             Kind::Url(ref e) => Some(e), | ||||
|             #[cfg(feature = "default-tls")] | ||||
|             Kind::Tls(ref e) => Some(e), | ||||
|             Kind::Io(ref e) => Some(e), | ||||
|             Kind::UrlEncoded(ref e) => Some(e), | ||||
| @@ -224,6 +225,7 @@ impl fmt::Display for Error { | ||||
|             Kind::Mime(ref e) => fmt::Display::fmt(e, f), | ||||
|             Kind::Url(ref e) => fmt::Display::fmt(e, f), | ||||
|             Kind::UrlBadScheme => f.write_str("URL scheme is not allowed"), | ||||
|             #[cfg(feature = "default-tls")] | ||||
|             Kind::Tls(ref e) => fmt::Display::fmt(e, f), | ||||
|             Kind::Io(ref e) => fmt::Display::fmt(e, f), | ||||
|             Kind::UrlEncoded(ref e) => fmt::Display::fmt(e, f), | ||||
| @@ -250,6 +252,7 @@ impl StdError for Error { | ||||
|             Kind::Mime(ref e) => e.description(), | ||||
|             Kind::Url(ref e) => e.description(), | ||||
|             Kind::UrlBadScheme => "URL scheme is not allowed", | ||||
|             #[cfg(feature = "default-tls")] | ||||
|             Kind::Tls(ref e) => e.description(), | ||||
|             Kind::Io(ref e) => e.description(), | ||||
|             Kind::UrlEncoded(ref e) => e.description(), | ||||
| @@ -267,6 +270,7 @@ impl StdError for Error { | ||||
|             Kind::Hyper(ref e) => e.cause(), | ||||
|             Kind::Mime(ref e) => e.cause(), | ||||
|             Kind::Url(ref e) => e.cause(), | ||||
|             #[cfg(feature = "default-tls")] | ||||
|             Kind::Tls(ref e) => e.cause(), | ||||
|             Kind::Io(ref e) => e.cause(), | ||||
|             Kind::UrlEncoded(ref e) => e.cause(), | ||||
| @@ -287,6 +291,7 @@ pub(crate) enum Kind { | ||||
|     Mime(::mime::FromStrError), | ||||
|     Url(::url::ParseError), | ||||
|     UrlBadScheme, | ||||
|     #[cfg(feature = "default-tls")] | ||||
|     Tls(::native_tls::Error), | ||||
|     Io(io::Error), | ||||
|     UrlEncoded(::serde_urlencoded::ser::Error), | ||||
| @@ -347,6 +352,7 @@ impl From<::serde_json::Error> for Kind { | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "default-tls")] | ||||
| impl From<::native_tls::Error> for Kind { | ||||
|     fn from(err: ::native_tls::Error) -> Kind { | ||||
|         Kind::Tls(err) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user