Repository: elastic-rs/elastic (language: rust)

Issue:
OpenSSL requirement from reqwest
0.21.0-pre.2

Reqwest has an optional feature to switch to "rustls-tls".  This allows much easier cross compilation.  Elastic uses reqwest, but just uses it as is, so it is pulling in hyper-tls, which requires openssl.  

I do not beleive(though I could be wrong).  That this is something that can be externally changed in cargo.  So, the question is, is it possible to enable a passthrough feature that would allow the use of elastic with rustls-tls, or to default for compatibility.


Discussion / hints:
Hi @jatsrt :wave:

If you add `reqwest` as a dependency in your Cargo.toml alongside `elastic` with the `rustls-tls` feature then it should all work, but I'd also be happy to add a `rustls-tls` feature to `elastic` that enabled the same feature in its own `reqwest` dependency.
Tried that, as I already use reqwest for other purposes, didn't work.

```
[dependencies]
serde = "1.0"
serde_json = { version = "1.0", features = ["arbitrary_precision"] }
serde_derive = "1.0"
elastic = "0.21.0-pre.2"
elastic_derive = "0.21.0-pre.2"

reqwest = {version = "0.9", default_features = false, features=["rustls-tls"]}
```
unless I need to match the version exactly with "~0.9"
OK, no that did not do the trick

```
serde = "1.0"
serde_json = { version = "1.0", features = ["arbitrary_precision"] }
serde_derive = "1.0"
elastic = "0.21.0-pre.2"
elastic_derive = "0.21.0-pre.2"

reqwest = {version = "~0.9", default_features = false, features=["rustls-tls"]}
```
Ah right, so `reqwest` uses a `default-tls` feature that we have to disable before it'll stop compiling `openssl`, in which case just adding a dependency on `reqwest` yourself won't be enough.

Fix patch:
diff --git a/src/elastic/Cargo.toml b/src/elastic/Cargo.toml
index 4edc8236f1..ff8e03b226 100644
--- a/src/elastic/Cargo.toml
+++ b/src/elastic/Cargo.toml
@@ -24,7 +24,7 @@ http = "~0.1"
 serde = "~1"
 serde_json = "~1"
 serde_derive = "~1"
-reqwest = "~0.9"
+reqwest = { version = "~0.9", default-features = false, features = ["rustls-tls"]}
 futures = "~0.1"
 tokio = "~0.1"
 tokio-threadpool = "~0.1"
diff --git a/src/elastic/src/error.rs b/src/elastic/src/error.rs
index 90a425e324..f65dae1c45 100644
--- a/src/elastic/src/error.rs
+++ b/src/elastic/src/error.rs
@@ -110,8 +110,8 @@ impl StdError for WrappedError {
         self.0.description()
     }
 
-    fn cause(&self) -> Option<&StdError> {
-        self.0.cause()
+    fn source(&self) -> Option<&(StdError + 'static)> {
+        self.0.source()
     }
 }
 
@@ -126,8 +126,8 @@ impl StdError for ClientError {
         self.inner.description()
     }
 
-    fn cause(&self) -> Option<&StdError> {
-        self.inner.cause()
+    fn source(&self) -> Option<&(StdError + 'static)> {
+        self.inner.source()
     }
 }
 


Test patch: