Merge pull request #847 from sfackler/version2

Actually add version stuff
This commit is contained in:
Steven Fackler 2018-02-21 23:30:33 -08:00 committed by GitHub
commit c1a106fc68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 7 deletions

View File

@ -2,6 +2,14 @@
## [Unreleased] ## [Unreleased]
### Added
* Added `SslRef::version2`.
### Deprecated
* `SslRef::version` has been deprecated. Use `SslRef::version_str` instead.
## [v0.10.4] - 2018-02-18 ## [v0.10.4] - 2018-02-18
### Added ### Added
@ -9,7 +17,7 @@
* Added OpenSSL 1.1.1 support. * Added OpenSSL 1.1.1 support.
* Added `Rsa::public_key_from_pem_pkcs1`. * Added `Rsa::public_key_from_pem_pkcs1`.
* Added `SslOptions::NO_TLSV1_3`. (OpenSSL 1.1.1 only) * Added `SslOptions::NO_TLSV1_3`. (OpenSSL 1.1.1 only)
* Added `SslVersion` and `SslRef::version2`. * Added `SslVersion`.
* Added `SslSessionCacheMode` and `SslContextBuilder::set_session_cache_mode`. * Added `SslSessionCacheMode` and `SslContextBuilder::set_session_cache_mode`.
* Added `SslContextBuilder::set_new_session_callback`, * Added `SslContextBuilder::set_new_session_callback`,
`SslContextBuilder::set_remove_session_callback`, and `SslContextBuilder::set_remove_session_callback`, and
@ -22,10 +30,6 @@
* The `SslAcceptorBuilder::mozilla_modern` constructor now disables TLSv1.0 and TLSv1.1 in * The `SslAcceptorBuilder::mozilla_modern` constructor now disables TLSv1.0 and TLSv1.1 in
accordance with Mozilla's recommendations. accordance with Mozilla's recommendations.
### Deprecated
* `SslRef::version` has been deprecated. Use `SslRef::version_str` instead.
## [v0.10.3] - 2018-02-12 ## [v0.10.3] - 2018-02-12
### Added ### Added

View File

@ -1957,12 +1957,26 @@ impl SslRef {
} }
} }
#[deprecated(since = "0.10.5", note = "renamed to `version_str`")]
pub fn version(&self) -> &str {
self.version_str()
}
/// Returns the protocol version of the session.
///
/// This corresponds to [`SSL_version`].
///
/// [`SSL_version`]: https://www.openssl.org/docs/manmaster/man3/SSL_version.html
pub fn version2(&self) -> SslVersion {
unsafe { SslVersion(ffi::SSL_version(self.as_ptr())) }
}
/// Returns a string describing the protocol version of the session. /// Returns a string describing the protocol version of the session.
/// ///
/// This corresponds to [`SSL_get_version`]. /// This corresponds to [`SSL_get_version`].
/// ///
/// [`SSL_get_version`]: https://www.openssl.org/docs/man1.1.0/ssl/SSL_get_version.html /// [`SSL_get_version`]: https://www.openssl.org/docs/man1.1.0/ssl/SSL_get_version.html
pub fn version(&self) -> &'static str { pub fn version_str(&self) -> &'static str {
let version = unsafe { let version = unsafe {
let ptr = ffi::SSL_get_version(self.as_ptr()); let ptr = ffi::SSL_get_version(self.as_ptr());
CStr::from_ptr(ptr as *const _) CStr::from_ptr(ptr as *const _)
@ -2004,7 +2018,7 @@ impl SslRef {
/// If this is greater than 0, the next call to `read` will not call down to the underlying /// If this is greater than 0, the next call to `read` will not call down to the underlying
/// stream. /// stream.
/// ///
/// This corresponds to [`SSL_pending]`. /// This corresponds to [`SSL_pending`].
/// ///
/// [`SSL_pending`]: https://www.openssl.org/docs/man1.1.0/ssl/SSL_pending.html /// [`SSL_pending`]: https://www.openssl.org/docs/man1.1.0/ssl/SSL_pending.html
pub fn pending(&self) -> usize { pub fn pending(&self) -> usize {