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
Download history 2551/week @ 2020-10-06 2876/week @ 2020-10-13 2727/week @ 2020-10-20 2671/week @ 2020-10-27 2540/week @ 2020-11-03 2423/week @ 2020-11-10 2691/week @ 2020-11-17 2501/week @ 2020-11-24 2975/week @ 2020-12-01 3039/week @ 2020-12-08 2517/week @ 2020-12-15 2185/week @ 2020-12-22 1918/week @ 2020-12-29 2955/week @ 2021-01-05 2730/week @ 2021-01-12 2752/week @ 2021-01-19

10,130 downloads per month
Used in less than 59 crates

MIT/Apache

11KB
211 lines

hyper-native-tls

Build Status

Documentation

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

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

~3.5MB
~94K SLoC