@@ -29,7 +29,7 @@ use crate::api::timestamp;
29
29
use bytes:: Buf as _;
30
30
use fnv:: FnvHashMap ;
31
31
use futures:: { prelude:: * , channel:: mpsc, compat:: Compat01As03 } ;
32
- use log:: { warn , error} ;
32
+ use log:: error;
33
33
use primitives:: offchain:: { HttpRequestId , Timestamp , HttpRequestStatus , HttpError } ;
34
34
use std:: { fmt, io:: Read as _, mem, pin:: Pin , task:: Context , task:: Poll } ;
35
35
@@ -554,9 +554,7 @@ enum WorkerToApi {
554
554
/// Wraps around a `hyper::Client` with either TLS enabled or disabled.
555
555
enum HyperClient {
556
556
/// Everything is ok and HTTPS is available.
557
- Https ( hyper:: Client < hyper_tls:: HttpsConnector < hyper:: client:: HttpConnector > , hyper:: Body > ) ,
558
- /// We failed to initialize HTTPS and therefore only allow HTTP.
559
- Http ( hyper:: Client < hyper:: client:: HttpConnector , hyper:: Body > ) ,
557
+ Https ( hyper:: Client < hyper_rustls:: HttpsConnector < hyper:: client:: HttpConnector > , hyper:: Body > ) ,
560
558
}
561
559
562
560
impl HyperClient {
@@ -565,13 +563,8 @@ impl HyperClient {
565
563
/// By default we will try to initialize the `HttpsConnector`,
566
564
/// If that's not possible we'll fall back to `HttpConnector`.
567
565
pub fn new ( ) -> Self {
568
- match hyper_tls:: HttpsConnector :: new ( 1 ) {
569
- Ok ( tls) => HyperClient :: Https ( hyper:: Client :: builder ( ) . build ( tls) ) ,
570
- Err ( e) => {
571
- warn ! ( "Unable to initialize TLS client. Falling back to HTTP-only: {:?}" , e) ;
572
- HyperClient :: Http ( hyper:: Client :: new ( ) )
573
- } ,
574
- }
566
+ let tls = hyper_rustls:: HttpsConnector :: new ( 1 ) ;
567
+ HyperClient :: Https ( hyper:: Client :: builder ( ) . build ( tls) )
575
568
}
576
569
}
577
570
@@ -687,7 +680,6 @@ impl Future for HttpWorker {
687
680
Poll :: Ready ( None ) => return Poll :: Ready ( ( ) ) , // stops the worker
688
681
Poll :: Ready ( Some ( ApiToWorker :: Dispatch { id, request } ) ) => {
689
682
let future = Compat01As03 :: new ( match me. http_client {
690
- HyperClient :: Http ( ref mut c) => c. request ( request) ,
691
683
HyperClient :: Https ( ref mut c) => c. request ( request) ,
692
684
} ) ;
693
685
debug_assert ! ( me. requests. iter( ) . all( |( i, _) | * i != id) ) ;
0 commit comments