File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -71,16 +71,23 @@ impl Service for HttpConnector {
71
71
type Error = io:: Error ;
72
72
type Future = HttpConnecting ;
73
73
74
- fn call ( & self , url : Uri ) -> Self :: Future {
75
- debug ! ( "Http::connect({:?})" , url ) ;
76
- let host = match url . host ( ) {
74
+ fn call ( & self , uri : Uri ) -> Self :: Future {
75
+ debug ! ( "Http::connect({:?})" , uri ) ;
76
+ let host = match uri . host ( ) {
77
77
Some ( s) => s,
78
78
None => return HttpConnecting {
79
79
state : State :: Error ( Some ( io:: Error :: new ( io:: ErrorKind :: InvalidInput , "invalid url" ) ) ) ,
80
80
handle : self . handle . clone ( ) ,
81
81
} ,
82
82
} ;
83
- let port = url. port ( ) . unwrap_or ( 80 ) ;
83
+ let port = match uri. port ( ) {
84
+ Some ( port) => port,
85
+ None => match uri. scheme ( ) {
86
+ Some ( "http" ) => 80 ,
87
+ Some ( "https" ) => 443 ,
88
+ _ => 80 ,
89
+ } ,
90
+ } ;
84
91
85
92
HttpConnecting {
86
93
state : State :: Resolving ( self . dns . resolve ( host. into ( ) , port) ) ,
You can’t perform that action at this time.
0 commit comments