swiftlang / swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence
swift.org
Apache License 2.0
5.27k stars 1.13k forks source link

[SR-7938] URLProtectionSpace doesn't have `description` implemented #3680

Closed pushkarnk closed 6 years ago

pushkarnk commented 6 years ago
Previous ID SR-7938
Radar None
Original Reporter @pushkarnk
Type Bug
Status Closed
Resolution Done
Environment Linux
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Foundation | |Labels | Bug | |Assignee | cmilr (JIRA) | |Priority | Medium | md5: 13b9fa32310244d1ba0d11550336f74e

Issue Description:

import Foundation
let space = URLProtectionSpace(host: "apple.com", port: 80, protocol: "http", realm: nil, authenticationMethod: "basic")
print(space)

Output on macOS:

\<NSURLProtectionSpace: 0x7fa5bfea8620>: Host:apple.com, Server:http, Auth-Scheme:NSURLAuthenticationMethodDefault, Realm:(null), Port:80, Proxy:NO, Proxy-Type:(null)

Output on Linux:
\<URLProtectionSpace: 0x0000557e8e182100>

swift-ci commented 6 years ago

Comment by Cary Miller (JIRA)

I'm almost finished building this out, but I'm stuck on how to handle the authenticationMethod argument in the description above. In Foundation on Darwin, no matter what string I throw at it, it seems to always output:

Auth-Scheme:NSURLAuthenticationMethodDefault

I don't understand how a given input String maps to the various NSURLAuthenticationMethods, or if they even do?

Any guidance would be appreciated.

swift-ci commented 6 years ago

Comment by Cary Miller (JIRA)

Nevermind, I seem to have figured it out, thanks!

swift-ci commented 6 years ago

Comment by Cary Miller (JIRA)

https://github.com/apple/swift-corelibs-foundation/pull/1607