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

Download history 1132/week @ 2023-12-11 1234/week @ 2023-12-18 735/week @ 2023-12-25 601/week @ 2024-01-01 1251/week @ 2024-01-08 1027/week @ 2024-01-15 951/week @ 2024-01-22 747/week @ 2024-01-29 1045/week @ 2024-02-05 1231/week @ 2024-02-12 1206/week @ 2024-02-19 1187/week @ 2024-02-26 1251/week @ 2024-03-04 1251/week @ 2024-03-11 1346/week @ 2024-03-18 1555/week @ 2024-03-25

5,524 downloads per month
This crate has lost popularity

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

~4–15MB
~210K SLoC