Skip to content

Instantly share code, notes, and snippets.

@nshtg
Forked from p-jackson/Cargo.toml
Created July 25, 2016 11:41
Show Gist options
  • Save nshtg/13f9f596ca55e0998e0b5bde881e75f7 to your computer and use it in GitHub Desktop.
Save nshtg/13f9f596ca55e0998e0b5bde881e75f7 to your computer and use it in GitHub Desktop.
Https with hyper on Windows without using OpenSSL
[dependencies]
schannel = "0.0.2"
[dependencies.hyper]
version = "0.7"
default-features = false
extern crate hyper;
extern crate schannel;
use std::sync::Arc;
use std::io::Read;
use hyper::Client;
use hyper::net::HttpsConnector;
use schannel::hyperimpl::Schannel;
use schannel::{SslInfo, SslInfoClient};
fn main() {
let sslinfo = SslInfo::Client(SslInfoClient::new());
let schan = Schannel { info: Arc::new(sslinfo) };
let connector = HttpsConnector::<Schannel>::new(schan);
let client = Client::with_connector(connector);
let mut res = client.get("https://github.com").send().unwrap();
let mut body = String::new();
res.read_to_string(&mut body).unwrap();
println!("{}", body);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment