7 releases
Uses old Rust 2015
0.3.0 | Sep 18, 2018 |
---|---|
0.2.4 | Jun 6, 2017 |
0.2.3 | May 31, 2017 |
0.2.2 | Jan 31, 2017 |
0.1.0 | Jan 8, 2017 |
#18 in #tls-client
5,524 downloads per month
This crate has lost popularity
11KB
211 lines
hyper-native-tls
native-tls
support for Hyper 0.10.
Warning
This crate does not support the Tokio-based Hyper 0.11 release. Use the tokio-tls
crate instead.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
lib.rs
:
SSL support for Hyper via the native-tls crate.
Usage
On the client side:
extern crate hyper;
extern crate hyper_native_tls;
use hyper::Client;
use hyper::net::HttpsConnector;
use hyper_native_tls::NativeTlsClient;
use std::io::Read;
fn main() {
let ssl = NativeTlsClient::new().unwrap();
let connector = HttpsConnector::new(ssl);
let client = Client::with_connector(connector);
let mut resp = client.get("https://google.com").send().unwrap();
let mut body = vec![];
resp.read_to_end(&mut body).unwrap();
println!("{}", String::from_utf8_lossy(&body));
}
Or on the server side:
extern crate hyper;
extern crate hyper_native_tls;
use hyper::Server;
use hyper_native_tls::NativeTlsServer;
fn main() {
let ssl = NativeTlsServer::new("identity.p12", "mypass").unwrap();
let server = Server::https("0.0.0.0:8443", ssl).unwrap();
}
Dependencies
~4–15MB
~210K SLoC