From e85b49d3755375b3e535cbd4b07d4fbf953948cb Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Fri, 18 Dec 2015 21:19:16 -0800 Subject: Work around the worst of clone bogusness SslStream::{clone,try_clone} are inherently broken since the Ssl object shared by both streams is only going to be talking to one stream. Stuff like hyper depends on try_clone, so we'll leave it here for now but minimize the brokenness to "no worse than what it used to be like". They'll be removed in 0.8. cc #325 --- openssl/src/ssl/tests/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'openssl/src/ssl/tests') diff --git a/openssl/src/ssl/tests/mod.rs b/openssl/src/ssl/tests/mod.rs index 7ed8fc3b..af3c005e 100644 --- a/openssl/src/ssl/tests/mod.rs +++ b/openssl/src/ssl/tests/mod.rs @@ -949,3 +949,11 @@ fn test_read_nonblocking() { assert!(bytes_read >= 5); assert_eq!(&input_buffer[..5], b"HTTP/"); } + +#[test] +fn broken_try_clone_doesnt_crash() { + let context = SslContext::new(SslMethod::Sslv23).unwrap(); + let inner = TcpStream::connect("example.com:443").unwrap(); + let stream1 = SslStream::connect(&context, inner).unwrap(); + let _stream2 = stream1.try_clone().unwrap(); +} -- cgit v1.2.3