@@ -8,9 +8,9 @@ use self::openssl::ssl::{IntoSsl, SslContext, SslStream, SslMethod, SSL_VERIFY_P
88 SSL_OP_NO_SSLV2 , SSL_OP_NO_SSLV3 , SSL_OP_NO_COMPRESSION } ;
99use self :: openssl:: ssl:: error:: SslError ;
1010use self :: openssl_verify:: verify_callback;
11- use io:: { StreamWrapper , Stream , NegotiateSsl } ;
11+ use io:: { TlsStream , Stream , TlsHandshake } ;
1212
13- impl StreamWrapper for SslStream < Stream > {
13+ impl TlsStream for SslStream < Stream > {
1414 fn get_ref ( & self ) -> & Stream {
1515 self . get_ref ( )
1616 }
@@ -20,17 +20,17 @@ impl StreamWrapper for SslStream<Stream> {
2020 }
2121}
2222
23- /// A `NegotiateSsl ` implementation that uses OpenSSL.
23+ /// A `TlsHandshake ` implementation that uses OpenSSL.
2424///
2525/// Requires the `with-openssl` feature.
2626#[ derive( Debug ) ]
27- pub struct Negotiator ( SslContext ) ;
27+ pub struct OpenSsl ( SslContext ) ;
2828
29- impl Negotiator {
30- /// Creates a `Negotiator ` with a reasonable default configuration.
29+ impl OpenSsl {
30+ /// Creates a `OpenSsl ` with a reasonable default configuration.
3131 ///
3232 /// The configuration is modeled after libcurl's and is subject to change.
33- pub fn new ( ) -> Result < Negotiator , SslError > {
33+ pub fn new ( ) -> Result < OpenSsl , SslError > {
3434 let mut ctx = try!( SslContext :: new ( SslMethod :: Sslv23 ) ) ;
3535 try!( ctx. set_default_verify_paths ( ) ) ;
3636 ctx. set_options ( SSL_OP_NO_SSLV2 | SSL_OP_NO_SSLV3 | SSL_OP_NO_COMPRESSION ) ;
@@ -49,17 +49,17 @@ impl Negotiator {
4949 }
5050}
5151
52- impl From < SslContext > for Negotiator {
53- fn from ( ctx : SslContext ) -> Negotiator {
54- Negotiator ( ctx)
52+ impl From < SslContext > for OpenSsl {
53+ fn from ( ctx : SslContext ) -> OpenSsl {
54+ OpenSsl ( ctx)
5555 }
5656}
5757
58- impl NegotiateSsl for Negotiator {
59- fn negotiate_ssl ( & self ,
58+ impl TlsHandshake for OpenSsl {
59+ fn tls_handshake ( & self ,
6060 domain : & str ,
6161 stream : Stream )
62- -> Result < Box < StreamWrapper > , Box < Error + Send + Sync > > {
62+ -> Result < Box < TlsStream > , Box < Error + Send + Sync > > {
6363 let domain = domain. to_owned ( ) ;
6464 let mut ssl = try!( self . 0 . into_ssl ( ) ) ;
6565 ssl. set_verify_callback ( SSL_VERIFY_PEER , move |p, x| verify_callback ( & domain, p, x) ) ;
0 commit comments