Skip to content

Commit

Permalink
fix(windows): disable openssl cert validation for Windows
Browse files Browse the repository at this point in the history
It doesn't work, so it's just causing errors.

Closes #794
  • Loading branch information
seanmonstar committed May 17, 2016
1 parent 3c0e105 commit c89aca8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,13 +671,22 @@ mod openssl {
impl<T: NetworkStream + Send + Clone> super::SslClient<T> for OpensslClient {
type Stream = SslStream<T>;

#[cfg(not(windows))]
fn wrap_client(&self, stream: T, host: &str) -> ::Result<Self::Stream> {
let mut ssl = try!(Ssl::new(&self.0));
try!(ssl.set_hostname(host));
let host = host.to_owned();
ssl.set_verify_callback(SSL_VERIFY_PEER, move |p, x| ::openssl_verify::verify_callback(&host, p, x));
SslStream::connect(ssl, stream).map_err(From::from)
}


#[cfg(windows)]
fn wrap_client(&self, stream: T, host: &str) -> ::Result<Self::Stream> {
let mut ssl = try!(Ssl::new(&self.0));
try!(ssl.set_hostname(host));
SslStream::connect(ssl, stream).map_err(From::from)
}
}

impl Default for Openssl {
Expand Down

0 comments on commit c89aca8

Please sign in to comment.