Commit 696b1961 authored by Steven Fackler's avatar Steven Fackler
Browse files

Rename getters in line with conventions

parent a0549c16
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -767,7 +767,7 @@ impl SslContext {
        SslContextOptions::from_bits(ret).unwrap()
    }

    pub fn get_options(&mut self) -> SslContextOptions {
    pub fn options(&mut self) -> SslContextOptions {
        let ret = unsafe { ffi_extras::SSL_CTX_get_options(self.ctx) };
        SslContextOptions::from_bits(ret).unwrap()
    }
@@ -982,7 +982,7 @@ impl Ssl {
        }
    }

    pub fn get_current_cipher<'a>(&'a self) -> Option<SslCipher<'a>> {
    pub fn current_cipher<'a>(&'a self) -> Option<SslCipher<'a>> {
        unsafe {
            let ptr = ffi::SSL_get_current_cipher(self.ssl);

@@ -1119,7 +1119,7 @@ impl Ssl {
        Some(s)
    }

    pub fn get_ssl_method(&self) -> Option<SslMethod> {
    pub fn ssl_method(&self) -> Option<SslMethod> {
        unsafe {
            let method = ffi::SSL_get_ssl_method(self.ssl);
            SslMethod::from_raw(method)
@@ -1127,7 +1127,7 @@ impl Ssl {
    }

    /// Returns the server's name for the current connection
    pub fn get_servername(&self) -> Option<String> {
    pub fn servername(&self) -> Option<String> {
        let name = unsafe { ffi::SSL_get_servername(self.ssl, ffi::TLSEXT_NAMETYPE_host_name) };
        if name == ptr::null() {
            return None;
@@ -1136,9 +1136,7 @@ impl Ssl {
        unsafe { String::from_utf8(CStr::from_ptr(name as *const _).to_bytes().to_vec()).ok() }
    }

    /// change the context corresponding to the current connection
    ///
    /// Returns a clone of the SslContext @ctx (ie: the new context). The old context is freed.
    /// Changes the context corresponding to the current connection.
    pub fn set_ssl_context(&self, ctx: &SslContext) -> Result<(), ErrorStack> {
        unsafe {
            try_ssl_null!(ffi::SSL_set_SSL_CTX(self.ssl, ctx.ctx));
@@ -1146,8 +1144,8 @@ impl Ssl {
        Ok(())
    }

    /// obtain the context corresponding to the current connection
    pub fn get_ssl_context(&self) -> SslContext {
    /// Returns the context corresponding to the current connection
    pub fn ssl_context(&self) -> SslContext {
        unsafe {
            let ssl_ctx = ffi::SSL_get_SSL_CTX(self.ssl);
            SslContext::new_ref(ssl_ctx)
+2 −2
Original line number Diff line number Diff line
@@ -227,7 +227,7 @@ run_test!(new_sslstream, |method, stream| {

run_test!(get_ssl_method, |method, _| {
    let ssl = Ssl::new(&SslContext::new(method).unwrap()).unwrap();
    assert_eq!(ssl.get_ssl_method(), Some(method));
    assert_eq!(ssl.ssl_method(), Some(method));
});

run_test!(verify_untrusted, |method, stream| {
@@ -462,7 +462,7 @@ fn test_set_certificate_and_private_key() {

run_test!(get_ctx_options, |method, _| {
    let mut ctx = SslContext::new(method).unwrap();
    ctx.get_options();
    ctx.options();
});

run_test!(set_ctx_options, |method, _| {