Skip to content
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

Parity: Networking: URLAuthenticationChallenge #2430

Merged
merged 1 commit into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 6 additions & 7 deletions Foundation/URLAuthenticationChallenge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -199,25 +199,24 @@ open class URLAuthenticationChallenge : NSObject, NSSecureCoding {
}
}

extension _HTTPURLProtocol : URLAuthenticationChallengeSender {

class URLSessionAuthenticationChallengeSender : NSObject, URLAuthenticationChallengeSender {
func cancel(_ challenge: URLAuthenticationChallenge) {
NSUnimplemented()
fatalError("swift-corelibs-foundation only supports URLSession; for challenges coming from URLSession, please implement the appropriate URLSessionTaskDelegate methods rather than using the sender argument.")
}

func continueWithoutCredential(for challenge: URLAuthenticationChallenge) {
NSUnimplemented()
fatalError("swift-corelibs-foundation only supports URLSession; for challenges coming from URLSession, please implement the appropriate URLSessionTaskDelegate methods rather than using the sender argument.")
}

func use(_ credential: URLCredential, for challenge: URLAuthenticationChallenge) {
NSUnimplemented()
fatalError("swift-corelibs-foundation only supports URLSession; for challenges coming from URLSession, please implement the appropriate URLSessionTaskDelegate methods rather than using the sender argument.")
}

func performDefaultHandling(for challenge: URLAuthenticationChallenge) {
NSUnimplemented()
fatalError("swift-corelibs-foundation only supports URLSession; for challenges coming from URLSession, please implement the appropriate URLSessionTaskDelegate methods rather than using the sender argument.")
}

func rejectProtectionSpaceAndContinue(with challenge: URLAuthenticationChallenge) {
NSUnimplemented()
fatalError("swift-corelibs-foundation only supports URLSession; for challenges coming from URLSession, please implement the appropriate URLSessionTaskDelegate methods rather than using the sender argument.")
}
}
2 changes: 1 addition & 1 deletion Foundation/URLSession/URLSessionTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ extension _ProtocolClient : URLProtocolClient {

let authenticationChallenge = URLAuthenticationChallenge(protectionSpace: protectionSpace, proposedCredential: proposedCredential,
previousFailureCount: task.previousFailureCount, failureResponse: response, error: nil,
sender: urlProtocol as! _HTTPURLProtocol)
sender: URLSessionAuthenticationChallengeSender())
task.previousFailureCount += 1
self.urlProtocol(urlProtocol, didReceive: authenticationChallenge)
}
Expand Down