-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[URLSession] Do not crash for unsupported URLs #3154
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
Conversation
Simple test to run on Darwin (e.g. from the REPL): import Foundation
URLSession.shared.dataTask(with: URL(string: "foo://x")!) { print("RESPONSE: \($0) \($1) \($2)") }.resume()
sleep(2) Outputs:
|
thanks @karwa once merged, should this also be back ported to 5.6? |
I'd be happy to back-port it to 5.6. I actually need this behaviour for something that I'd like to ship. (It's for WebURL foundation extensions - i.e. making URLSession requests directly using a |
Ping @millenomi I haven't actually been able to run TestFoundation on my Mac, since after following the instructions in the README, I get a bunch of errors about duplicate/ambiguous symbols from CoreFoundation (some conflict between the SDK module map and the included one), and running the tests on Linux involves building the entire Swift project. That said, I manually verified this on my Mac by adding a small executable target to the Foundation workspace which imported SwiftFoundationNetworking rather than Foundation. I verified that it hit the crash before the fix (so wasn't using the SDK copy) and didn't hit the crash after the fix. So I'd appreciate somebody triggering CI tests and letting me know if there are updated instructions to run TestFoundation on the Mac (or an easier way to run them on Linux). |
@millenomi Are you able to review this patch, or recommend somebody? |
@swift-ci please test and merge |
Yeah, please stand by wrt macOS. |
@millenomi Would you be able to trigger tests again? Seems from the other PR that plain swift-ci "test" works. |
@swift-ci Please test |
@karwa this would be nice to get into 5.6.3: https://forums.swift.org/t/development-open-for-swift-5-6-3-for-linux-and-windows/58859 Can we get CI green so its mergable? |
@karwa this would be nice to get into 5.7 Can we get CI green so its mergable and brought over the the 5.7 branch? |
@tomerd Apologies for the lateness; I think it should be fixed now. Could you trigger CI again, please? |
@swift-ci Please test |
@parkera you okay to merge this? |
Thank you! |
@karwa @parkera do we want to try and pull this into 5.7 branch? cc @shahmishal |
Tasks which request unsupported URL protocols, or which request
nil
URLs, should return "unsupported URL" errors rather than crash. Matches Darwin behaviour.