Expand description
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();
}
Re-exports§
pub extern crate native_tls;
Structs§
- An X509 certificate.
- An
SslClient
implementation using native-tls. - An
SslServer
implementation using native-tls. - A guard around a locked inner
TlsStream
. - A Hyper stream using native_tls.
Enums§
- An error creating a
NativeTlsServer
.