Skip to content

Commit

Permalink
feat(net): add https_using_context for user-supplied SslContext
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedilger committed Apr 26, 2015
1 parent 9d83ed6 commit 1a076d1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ impl HttpListener {
try!(ssl_context.set_certificate_file(cert, X509FileType::PEM).map_err(lift_ssl_error));
try!(ssl_context.set_private_key_file(key, X509FileType::PEM).map_err(lift_ssl_error));
ssl_context.set_verify(SSL_VERIFY_NONE, None);
HttpListener::https_with_context(addr, ssl_context)
}

/// Start listening to an address of HTTPS using the given SslContext
pub fn https_with_context<To: ToSocketAddrs>(addr: To, ssl_context: SslContext) -> io::Result<HttpListener> {
Ok(HttpListener::Https(try!(TcpListener::bind(addr)), Arc::new(ssl_context)))
}
}
Expand Down

0 comments on commit 1a076d1

Please sign in to comment.