File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -452,7 +452,8 @@ impl Proxy {
452452}
453453
454454fn cache_maybe_has_http_auth ( url : & Url , extra : & Option < HeaderValue > ) -> bool {
455- url. scheme ( ) == "http" && ( url. password ( ) . is_some ( ) || extra. is_some ( ) )
455+ url. scheme ( ) == "http"
456+ && ( url. username ( ) . len ( ) > 0 || url. password ( ) . is_some ( ) || extra. is_some ( ) )
456457}
457458
458459fn cache_maybe_has_http_custom_headers ( url : & Url , extra : & Option < HeaderMap > ) -> bool {
@@ -917,6 +918,12 @@ mod tests {
917918 . unwrap ( )
918919 . into_matcher ( ) ;
919920 assert ! ( m. maybe_has_http_auth( ) , "http forwards" ) ;
921+
922+ let m = Proxy :: all ( "http://:in@yo.local" ) . unwrap ( ) . into_matcher ( ) ;
923+ assert ! ( m. maybe_has_http_auth( ) , "http forwards with empty username" ) ;
924+
925+ let m = Proxy :: all ( "http://letme:@yo.local" ) . unwrap ( ) . into_matcher ( ) ;
926+ assert ! ( m. maybe_has_http_auth( ) , "http forwards with empty password" ) ;
920927 }
921928
922929 #[ test]
You can’t perform that action at this time.
0 commit comments