Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https does not work out of the box. #17

Open
bentwire opened this issue Dec 27, 2018 · 3 comments
Open

https does not work out of the box. #17

bentwire opened this issue Dec 27, 2018 · 3 comments

Comments

@bentwire
Copy link

Tried setting it up today to interface to an api I use at work, and it does not work. Seems to not know what an https:// URL is...

Do you have any examples that work with https with the latest dependencies?

Thanks!

@abonander
Copy link
Owner

That's more of a Hyper limitation actually. Fortunately it's pretty simple to fix up, you just have to construct a hyper::Client with a TLS-capable Connector. hyper-native-tls seems to be the best implementation of that right now:

Cargo.toml:

[dependencies]
# ADD
hyper-native-tls = "0.3"

Then when building your Adaptor:

extern crate hyper_native_tls;
extern crate anterofit;

use hyper_native_tls::NativeTlsClient;

use anterofit::Adapter;
use anterofit::hyper::net::HttpsConnector;
use anterofit::hyper::Client;

let ssl = NativeTlsClient::new().unwrap(); // or handle the error
let connector = HttpsConnector::new(ssl);
let client = Client::with_connector(connector);

let adapter = Adapter::builder().client(client).build();

@bentwire
Copy link
Author

Perfect! Thank you!

@bentwire
Copy link
Author

Could you add this to the docs somewhere please? So others don't get discouraged if it does not work at first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants