File tree 3 files changed +11
-7
lines changed
3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -234,8 +234,8 @@ where
234
234
Some ( s) => s,
235
235
None => return invalid_url ( InvalidUrl :: MissingAuthority , & self . handle ) ,
236
236
} ;
237
- let port = match dst. uri . port ( ) {
238
- Some ( port) => port,
237
+ let port = match dst. uri . port_part ( ) {
238
+ Some ( port) => port. as_u16 ( ) ,
239
239
None => if dst. uri . scheme_part ( ) == Some ( & Scheme :: HTTPS ) { 443 } else { 80 } ,
240
240
} ;
241
241
Original file line number Diff line number Diff line change @@ -79,7 +79,10 @@ impl Destination {
79
79
/// Get the port, if specified.
80
80
#[ inline]
81
81
pub fn port ( & self ) -> Option < u16 > {
82
- self . uri . port ( )
82
+ match self . uri . port_part ( ) {
83
+ Some ( port) => Some ( port. as_u16 ( ) ) ,
84
+ None => None
85
+ }
83
86
}
84
87
85
88
/// Update the scheme of this destination.
@@ -140,7 +143,7 @@ impl Destination {
140
143
. map_err ( :: error:: Parse :: from) ?
141
144
} else {
142
145
let auth = host. parse :: < uri:: Authority > ( ) . map_err ( :: error:: Parse :: from) ?;
143
- if auth. port ( ) . is_some ( ) {
146
+ if auth. port_part ( ) . is_some ( ) { // std::uri::Authority::Uri
144
147
return Err ( :: error:: Parse :: Uri . into ( ) ) ;
145
148
}
146
149
auth
Original file line number Diff line number Diff line change @@ -212,8 +212,9 @@ where C: Connect + Sync + 'static,
212
212
format ! ( "{}://{}" , scheme, auth)
213
213
}
214
214
( None , Some ( auth) ) if is_http_connect => {
215
- let scheme = match auth. port ( ) {
216
- Some ( 443 ) => {
215
+ let port = auth. port_part ( ) . unwrap ( ) ;
216
+ let scheme = match port. as_str ( ) {
217
+ "443" => {
217
218
set_scheme ( req. uri_mut ( ) , Scheme :: HTTPS ) ;
218
219
"https"
219
220
} ,
@@ -278,7 +279,7 @@ where C: Connect + Sync + 'static,
278
279
. expect ( "HOST is always valid header name" )
279
280
. or_insert_with ( || {
280
281
let hostname = uri. host ( ) . expect ( "authority implies host" ) ;
281
- if let Some ( port) = uri. port ( ) {
282
+ if let Some ( port) = uri. port_part ( ) {
282
283
let s = format ! ( "{}:{}" , hostname, port) ;
283
284
HeaderValue :: from_str ( & s)
284
285
} else {
You can’t perform that action at this time.
0 commit comments