Skip to content

Commit 1a076d1

Browse files
committed
feat(net): add https_using_context for user-supplied SslContext
1 parent 9d83ed6 commit 1a076d1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/net.rs

+5
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ impl HttpListener {
164164
try!(ssl_context.set_certificate_file(cert, X509FileType::PEM).map_err(lift_ssl_error));
165165
try!(ssl_context.set_private_key_file(key, X509FileType::PEM).map_err(lift_ssl_error));
166166
ssl_context.set_verify(SSL_VERIFY_NONE, None);
167+
HttpListener::https_with_context(addr, ssl_context)
168+
}
169+
170+
/// Start listening to an address of HTTPS using the given SslContext
171+
pub fn https_with_context<To: ToSocketAddrs>(addr: To, ssl_context: SslContext) -> io::Result<HttpListener> {
167172
Ok(HttpListener::Https(try!(TcpListener::bind(addr)), Arc::new(ssl_context)))
168173
}
169174
}

0 commit comments

Comments
 (0)