File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Foundation/URLSession/http Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -391,17 +391,20 @@ internal extension _HTTPURLProtocol {
391391
392392 // If targetURL has only relative path of url, create a new valid url with relative path
393393 // Otherwise, return request with targetURL ie.url from location field
394- guard targetURL. scheme == nil || targetURL. host == nil else {
394+ guard targetURL. scheme == nil || targetURL. host == nil || targetURL . port == nil else {
395395 request. url = targetURL
396396 return request
397397 }
398398
399399 let scheme = request. url? . scheme
400400 let host = request. url? . host
401+ let port = request. url? . port
401402
402403 var components = URLComponents ( )
403404 components. scheme = scheme
404405 components. host = host
406+ components. port = port
407+
405408 //The path must either begin with "/" or be an empty string.
406409 if targetURL. relativeString. first != " / " {
407410 components. path = " / " + targetURL. relativeString
You can’t perform that action at this time.
0 commit comments