-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
workaround Foundation.URL behavior changes #777
Conversation
6b61458
to
8cf9960
Compare
@@ -48,9 +48,16 @@ extension DeconstructedURL { | |||
|
|||
switch scheme { | |||
case .http, .https: | |||
#if os(Linux) && compiler(>=6.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the wrong check: it's if !canImport(Darwin)
@@ -48,9 +48,16 @@ extension DeconstructedURL { | |||
|
|||
switch scheme { | |||
case .http, .https: | |||
#if os(Linux) && compiler(>=6.0) | |||
guard var urlHost = url.host, !urlHost.isEmpty else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guard var urlHost = url.host, !urlHost.isEmpty else { | |
guard let urlHost = url.host, !urlHost.isEmpty else { |
XCTAssertEqual(request3.host, "") | ||
#if os(Linux) && compiler(>=6.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same note here.
`Foundation.URL` has various behavior changes in Swift 6 to better match RFC 3986 which impact AHC. In particular it now no longer strips the square brackets in IPv6 hosts which are not tolerated by `inet_pton` so these must be manually stripped.
8cf9960
to
ee5009a
Compare
Foundation.URL
has various behavior changes in Swift 6 to better match RFC 3986 which impact AHC.In particular it now no longer strips the square brackets in IPv6 hosts which are not tolerated by
inet_pton
so these must be manually stripped.swiftlang/swift-foundation#957 - Initializing a URL from an IPv6 address in Swift 6 on Linux now does not strip enclosing square-brackets.
swiftlang/swift-foundation#958 - Initializing a URL from a unix file path in Swift 6 on Linux now returns a non-nil value (an empty
String
).swiftlang/swift-foundation#962 - Initializing a URL from an empty string in Swift 6 on Linux now returns a non-nil URL value.