File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -364,7 +364,7 @@ fn parse_env_uri(val: &str) -> Option<Intercept> {
364364 let user = percent_decode_str ( user) . decode_utf8_lossy ( ) ;
365365 let pass = percent_decode_str ( pass) . decode_utf8_lossy ( ) ;
366366 if is_httpish {
367- auth = Auth :: Basic ( encode_basic_auth ( & user, Some ( & pass) ) ) ;
367+ auth = Auth :: Basic ( crate :: util :: basic_auth ( & user, Some ( & pass) ) ) ;
368368 } else {
369369 auth = Auth :: Raw (
370370 Bytes :: from ( user. into_owned ( ) ) ,
@@ -384,24 +384,6 @@ fn parse_env_uri(val: &str) -> Option<Intercept> {
384384 Some ( Intercept { uri, auth } )
385385}
386386
387- fn encode_basic_auth ( user : & str , pass : Option < & str > ) -> HeaderValue {
388- use std:: io:: Write ;
389-
390- use base64:: { prelude:: BASE64_STANDARD , write:: EncoderWriter } ;
391-
392- let mut buf = b"Basic " . to_vec ( ) ;
393- {
394- let mut encoder = EncoderWriter :: new ( & mut buf, & BASE64_STANDARD ) ;
395- let _ = write ! ( encoder, "{user}:" ) ;
396- if let Some ( password) = pass {
397- let _ = write ! ( encoder, "{password}" ) ;
398- }
399- }
400- let mut header = HeaderValue :: from_bytes ( & buf) . expect ( "base64 is always valid HeaderValue" ) ;
401- header. set_sensitive ( true ) ;
402- header
403- }
404-
405387impl NoProxy {
406388 fn empty ( ) -> NoProxy {
407389 NoProxy {
You can’t perform that action at this time.
0 commit comments