@@ -16,17 +16,20 @@ use hyper::http::h1::parse_response;
1616use hyper:: header:: { Headers , Header , HeaderFormat , Host , Connection , ConnectionOption , Upgrade ,
1717 Protocol , ProtocolName } ;
1818use unicase:: UniCase ;
19- #[ cfg( any( feature="ssl" , feature="async-ssl" ) ) ]
20- use native_tls:: { TlsStream , TlsConnector } ;
2119use header:: extensions:: Extension ;
2220use header:: { WebSocketAccept , WebSocketKey , WebSocketVersion , WebSocketProtocol ,
2321 WebSocketExtensions , Origin } ;
2422use result:: { WSUrlErrorKind , WebSocketResult , WebSocketError } ;
25- #[ cfg( feature="ssl" ) ]
26- use stream:: NetworkStream ;
2723use stream:: { self , Stream } ;
2824
29- use super :: Client ;
25+ #[ cfg( feature="sync" ) ]
26+ use super :: sync:: Client ;
27+
28+ #[ cfg( feature="sync-ssl" ) ]
29+ use stream:: sync:: NetworkStream ;
30+
31+ #[ cfg( any( feature="sync-ssl" , feature="async-ssl" ) ) ]
32+ use native_tls:: { TlsStream , TlsConnector } ;
3033
3134#[ cfg( feature="async" ) ]
3235mod async_imports {
@@ -375,7 +378,7 @@ impl<'u> ClientBuilder<'u> {
375378 /// let message = Message::text("m337 47 7pm");
376379 /// client.send_message(&message).unwrap();
377380 /// ```
378- #[ cfg( feature="ssl" ) ]
381+ #[ cfg( feature="sync- ssl" ) ]
379382 pub fn connect (
380383 & mut self ,
381384 ssl_config : Option < TlsConnector > ,
@@ -406,6 +409,7 @@ impl<'u> ClientBuilder<'u> {
406409 /// // split into two (for some reason)!
407410 /// let (receiver, sender) = client.split().unwrap();
408411 /// ```
412+ #[ cfg( feature="sync" ) ]
409413 pub fn connect_insecure ( & mut self ) -> WebSocketResult < Client < TcpStream > > {
410414 let tcp_stream = try!( self . establish_tcp ( Some ( false ) ) ) ;
411415
@@ -416,7 +420,7 @@ impl<'u> ClientBuilder<'u> {
416420 /// This will only use an `SslStream`, this is useful
417421 /// when you want to be sure to connect over SSL or when you want access
418422 /// to the `SslStream` functions (without having to go through a `Box`).
419- #[ cfg( feature="ssl" ) ]
423+ #[ cfg( feature="sync- ssl" ) ]
420424 pub fn connect_secure (
421425 & mut self ,
422426 ssl_config : Option < TlsConnector > ,
@@ -458,6 +462,7 @@ impl<'u> ClientBuilder<'u> {
458462 /// let text = String::from_utf8(text).unwrap();
459463 /// assert!(text.contains("dGhlIHNhbXBsZSBub25jZQ=="), "{}", text);
460464 /// ```
465+ #[ cfg( feature="sync" ) ]
461466 pub fn connect_on < S > ( & mut self , mut stream : S ) -> WebSocketResult < Client < S > >
462467 where S : Stream
463468 {
@@ -476,6 +481,15 @@ impl<'u> ClientBuilder<'u> {
476481 Ok ( Client :: unchecked ( reader, response. headers , true , false ) )
477482 }
478483
484+ #[ cfg( feature="async-ssl" ) ]
485+ pub fn async_connect (
486+ self ,
487+ ssl_config : Option < TlsConnector > ,
488+ handle : & Handle ,
489+ ) -> async :: ClientNew < Box < stream:: async:: Stream + Send > > {
490+ unimplemented ! ( ) ;
491+ }
492+
479493 #[ cfg( feature="async-ssl" ) ]
480494 pub fn async_connect_secure (
481495 self ,
@@ -542,7 +556,7 @@ impl<'u> ClientBuilder<'u> {
542556
543557 #[ cfg( feature="async" ) ]
544558 pub fn async_connect_on < S > ( self , stream : S ) -> async :: ClientNew < S >
545- where S : stream:: AsyncStream + Send + ' static
559+ where S : stream:: async :: Stream + Send + ' static
546560 {
547561 let mut builder = ClientBuilder {
548562 url : Cow :: Owned ( self . url . into_owned ( ) ) ,
@@ -695,7 +709,7 @@ impl<'u> ClientBuilder<'u> {
695709 Ok ( TcpStream :: connect ( self . extract_host_port ( secure) ?) ?)
696710 }
697711
698- #[ cfg( any( feature="ssl" , feature="async-ssl" ) ) ]
712+ #[ cfg( any( feature="sync- ssl" , feature="async-ssl" ) ) ]
699713 fn extract_host_ssl_conn (
700714 & self ,
701715 connector : Option < TlsConnector > ,
@@ -711,7 +725,7 @@ impl<'u> ClientBuilder<'u> {
711725 Ok ( ( host, connector) )
712726 }
713727
714- #[ cfg( feature="ssl" ) ]
728+ #[ cfg( feature="sync- ssl" ) ]
715729 fn wrap_ssl (
716730 & self ,
717731 tcp_stream : TcpStream ,
0 commit comments