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

#35 in #native-tls

Download history 1515/week @ 2024-07-20 1226/week @ 2024-07-27 1104/week @ 2024-08-03 1690/week @ 2024-08-10 1238/week @ 2024-08-17 1276/week @ 2024-08-24 1134/week @ 2024-08-31 1081/week @ 2024-09-07 1036/week @ 2024-09-14 1379/week @ 2024-09-21 1192/week @ 2024-09-28 3099/week @ 2024-10-05 2565/week @ 2024-10-12 997/week @ 2024-10-19 1073/week @ 2024-10-26 1167/week @ 2024-11-02

6,380 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–13MB
~191K SLoC