aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/ssl
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-07-01 18:31:47 -0400
committerSteven Fackler <[email protected]>2016-07-01 18:31:47 -0400
commit121169c1f57bf0b1130b400d9ed6431855fb2e73 (patch)
treed9e7e34dbf92171ce7e1da484941ba52521596f0 /openssl/src/ssl
parentTest on 1.8 (diff)
downloadrust-openssl-121169c1f57bf0b1130b400d9ed6431855fb2e73.tar.xz
rust-openssl-121169c1f57bf0b1130b400d9ed6431855fb2e73.zip
Set auto retry
SSL_read returns a WANT_READ after a renegotiation by default which ends up bubbling up as a weird BUG error. Tell OpenSSL to just do the read again.
Diffstat (limited to 'openssl/src/ssl')
-rw-r--r--openssl/src/ssl/mod.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index f207416f..d0954bc7 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -566,6 +566,9 @@ impl SslContext {
let ctx = SslContext { ctx: ctx };
+ // this is a bit dubious (?)
+ try!(ctx.set_mode(ffi::SSL_MODE_AUTO_RETRY));
+
if method.is_dtls() {
ctx.set_read_ahead(1);
}
@@ -648,8 +651,12 @@ impl SslContext {
}
}
+ fn set_mode(&self, mode: c_long) -> Result<(), SslError> {
+ wrap_ssl_result(unsafe { ffi_extras::SSL_CTX_set_mode(self.ctx, mode) as c_int })
+ }
+
pub fn set_tmp_dh(&self, dh: DH) -> Result<(), SslError> {
- wrap_ssl_result(unsafe { ffi_extras::SSL_CTX_set_tmp_dh(self.ctx, dh.raw()) as i32 })
+ wrap_ssl_result(unsafe { ffi_extras::SSL_CTX_set_tmp_dh(self.ctx, dh.raw()) as c_int })
}
/// Use the default locations of trusted certificates for verification.