File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,10 @@ open class URLSession : NSObject {
191191 internal let taskRegistry = URLSession . _TaskRegistry ( )
192192 fileprivate let identifier : Int32
193193 fileprivate var invalidated = false
194+ fileprivate static let registerProtocols = {
195+ // TODO: We register all the native protocols here.
196+ let _ = URLProtocol . registerClass ( _HTTPURLProtocol. self)
197+ } ( )
194198
195199 /*
196200 * The shared session uses the currently set global NSURLCache,
@@ -221,7 +225,7 @@ open class URLSession : NSObject {
221225 self . _configuration = c
222226 self . multiHandle = _MultiHandle ( configuration: c, workQueue: workQueue)
223227 // registering all the protocol classes with URLProtocol
224- let _ = URLProtocol . registerClass ( _HTTPURLProtocol . self )
228+ let _ = URLSession . registerProtocols
225229 }
226230
227231 /*
@@ -248,7 +252,7 @@ open class URLSession : NSObject {
248252 self . _configuration = c
249253 self . multiHandle = _MultiHandle ( configuration: c, workQueue: workQueue)
250254 // registering all the protocol classes with URLProtocol
251- let _ = URLProtocol . registerClass ( _HTTPURLProtocol . self )
255+ let _ = URLSession . registerProtocols
252256 }
253257
254258 open let delegateQueue : OperationQueue
You can’t perform that action at this time.
0 commit comments