aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/ssl/tests.rs
diff options
context:
space:
mode:
authorManuel Schölling <[email protected]>2015-07-18 12:48:40 +0200
committerManuel Schölling <[email protected]>2015-07-18 13:00:34 +0200
commita43011d77c26b0a371565ffe284611091cfd1de3 (patch)
treee88b02921780ee10e777678ea166f85da2939331 /openssl/src/ssl/tests.rs
parentMerge pull request #239 from jethrogb/topic/x509_extension_fix (diff)
downloadrust-openssl-a43011d77c26b0a371565ffe284611091cfd1de3.tar.xz
rust-openssl-a43011d77c26b0a371565ffe284611091cfd1de3.zip
Fix probelms with DTLS when no packets are pending.
When using DTLS you might run into the situation where no packets are pending, so SSL_read returns len=0. On a TLS connection this means that the connection was closed, but on DTLS it does not (a DTLS connection cannot be closed in the usual sense). This commit fixes a bug introduced by c8d23f3. Conflicts: openssl/src/ssl/mod.rs
Diffstat (limited to 'openssl/src/ssl/tests.rs')
-rw-r--r--openssl/src/ssl/tests.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/openssl/src/ssl/tests.rs b/openssl/src/ssl/tests.rs
index 8401836d..3a8ffa2b 100644
--- a/openssl/src/ssl/tests.rs
+++ b/openssl/src/ssl/tests.rs
@@ -51,7 +51,7 @@ macro_rules! run_test(
use std::net::TcpStream;
use ssl;
use ssl::SslMethod;
- use ssl::{SslContext, SslStream, VerifyCallback};
+ use ssl::{SslContext, Ssl, SslStream, VerifyCallback};
use ssl::SSL_VERIFY_PEER;
use crypto::hash::Type::SHA256;
use x509::X509StoreContext;
@@ -86,6 +86,11 @@ run_test!(new_sslstream, |method, stream| {
SslStream::connect_generic(&SslContext::new(method).unwrap(), stream).unwrap();
});
+run_test!(get_ssl_method, |method, _| {
+ let ssl = Ssl::new(&SslContext::new(method).unwrap()).unwrap();
+ assert_eq!(ssl.get_ssl_method(), Some(method));
+});
+
run_test!(verify_untrusted, |method, stream| {
let mut ctx = SslContext::new(method).unwrap();
ctx.set_verify(SSL_VERIFY_PEER, None);