Created
July 14, 2016 11:34
-
-
Save p-jackson/198dd5de05b53d14b533d272f2eaefce to your computer and use it in GitHub Desktop.
Https with hyper on Windows without using OpenSSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[dependencies] | |
schannel = "0.0.2" | |
[dependencies.hyper] | |
version = "0.7" | |
default-features = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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