@@ -52,7 +52,7 @@ use std::time::Duration;
5252use reqwest:: header:: { HeaderMap , HeaderValue } ;
5353use reqwest:: { Client , ClientBuilder , NoProxy , Proxy , RequestBuilder } ;
5454use serde:: { Deserialize , Serialize } ;
55-
55+ use tracing :: debug ;
5656use crate :: config:: { fmt_duration, ConfigValue } ;
5757use crate :: path:: Path ;
5858use crate :: { GetOptions , Result } ;
@@ -593,16 +593,20 @@ impl ClientOptions {
593593 }
594594
595595 pub ( crate ) fn client ( & self ) -> Result < Client > {
596+ debug ! ( "ClientOptions::client() - start" ) ;
596597 let mut builder = ClientBuilder :: new ( ) ;
597598
599+ debug ! ( "ClientOptions::client() - builder" ) ;
598600 match & self . user_agent {
599601 Some ( user_agent) => builder = builder. user_agent ( user_agent. get ( ) ?) ,
600602 None => builder = builder. user_agent ( DEFAULT_USER_AGENT ) ,
601603 }
604+ debug ! ( "ClientOptions::client() - useragent" ) ;
602605
603606 if let Some ( headers) = & self . default_headers {
604607 builder = builder. default_headers ( headers. clone ( ) )
605608 }
609+ debug ! ( "ClientOptions::client() - headers" ) ;
606610
607611 if let Some ( proxy) = & self . proxy_url {
608612 let mut proxy = Proxy :: all ( proxy) . map_err ( map_client_error) ?;
@@ -622,59 +626,74 @@ impl ClientOptions {
622626
623627 builder = builder. proxy ( proxy) ;
624628 }
629+ debug ! ( "ClientOptions::client() - proxy settings" ) ;
625630
626631 for certificate in & self . root_certificates {
627632 builder = builder. add_root_certificate ( certificate. 0 . clone ( ) ) ;
628633 }
634+ debug ! ( "ClientOptions::client() - certs" ) ;
629635
630636 if let Some ( timeout) = & self . timeout {
631637 builder = builder. timeout ( timeout. get ( ) ?)
632638 }
639+ debug ! ( "ClientOptions::client() - timeout" ) ;
633640
634641 if let Some ( timeout) = & self . connect_timeout {
635642 builder = builder. connect_timeout ( timeout. get ( ) ?)
636643 }
644+ debug ! ( "ClientOptions::client() - connect_timeout" ) ;
637645
638646 if let Some ( timeout) = & self . pool_idle_timeout {
639647 builder = builder. pool_idle_timeout ( timeout. get ( ) ?)
640648 }
649+ debug ! ( "ClientOptions::client() - idle_timeout" ) ;
641650
642651 if let Some ( max) = & self . pool_max_idle_per_host {
643652 builder = builder. pool_max_idle_per_host ( max. get ( ) ?)
644653 }
654+ debug ! ( "ClientOptions::client() - max_idle" ) ;
645655
646656 if let Some ( interval) = & self . http2_keep_alive_interval {
647657 builder = builder. http2_keep_alive_interval ( interval. get ( ) ?)
648658 }
659+ debug ! ( "ClientOptions::client() - keep_alive_interval" ) ;
649660
650661 if let Some ( interval) = & self . http2_keep_alive_timeout {
651662 builder = builder. http2_keep_alive_timeout ( interval. get ( ) ?)
652663 }
664+ debug ! ( "ClientOptions::client() - keep_alive_timeout" ) ;
653665
654666 if self . http2_keep_alive_while_idle . get ( ) ? {
655667 builder = builder. http2_keep_alive_while_idle ( true )
656668 }
669+ debug ! ( "ClientOptions::client() - keep_alive_while_idle" ) ;
657670
658671 if let Some ( sz) = & self . http2_max_frame_size {
659672 builder = builder. http2_max_frame_size ( Some ( sz. get ( ) ?) )
660673 }
674+ debug ! ( "ClientOptions::client() - max_frame_size" ) ;
661675
662676 if self . http1_only . get ( ) ? {
663677 builder = builder. http1_only ( )
664678 }
679+ debug ! ( "ClientOptions::client() - http1_only" ) ;
665680
666681 if self . http2_only . get ( ) ? {
667682 builder = builder. http2_prior_knowledge ( )
668683 }
684+ debug ! ( "ClientOptions::client() - http2_only" ) ;
669685
670686 if self . allow_insecure . get ( ) ? {
671687 builder = builder. danger_accept_invalid_certs ( true )
672688 }
689+ debug ! ( "ClientOptions::client() - allow_insecure" ) ;
673690
674- builder
691+ let result = builder
675692 . https_only ( !self . allow_http . get ( ) ?)
676693 . build ( )
677- . map_err ( map_client_error)
694+ . map_err ( map_client_error) ;
695+ debug ! ( "ClientOptions::client() - end" ) ;
696+ result
678697 }
679698}
680699
0 commit comments