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 {
391
391
392
392
// If targetURL has only relative path of url, create a new valid url with relative path
393
393
// 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 {
395
395
request. url = targetURL
396
396
return request
397
397
}
398
398
399
399
let scheme = request. url? . scheme
400
400
let host = request. url? . host
401
+ let port = request. url? . port
401
402
402
403
var components = URLComponents ( )
403
404
components. scheme = scheme
404
405
components. host = host
406
+ components. port = port
407
+
405
408
//The path must either begin with "/" or be an empty string.
406
409
if targetURL. relativeString. first != " / " {
407
410
components. path = " / " + targetURL. relativeString
You can’t perform that action at this time.
0 commit comments