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 {
191
191
internal let taskRegistry = URLSession . _TaskRegistry ( )
192
192
fileprivate let identifier : Int32
193
193
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
+ } ( )
194
198
195
199
/*
196
200
* The shared session uses the currently set global NSURLCache,
@@ -221,7 +225,7 @@ open class URLSession : NSObject {
221
225
self . _configuration = c
222
226
self . multiHandle = _MultiHandle ( configuration: c, workQueue: workQueue)
223
227
// registering all the protocol classes with URLProtocol
224
- let _ = URLProtocol . registerClass ( _HTTPURLProtocol . self )
228
+ let _ = URLSession . registerProtocols
225
229
}
226
230
227
231
/*
@@ -248,7 +252,7 @@ open class URLSession : NSObject {
248
252
self . _configuration = c
249
253
self . multiHandle = _MultiHandle ( configuration: c, workQueue: workQueue)
250
254
// registering all the protocol classes with URLProtocol
251
- let _ = URLProtocol . registerClass ( _HTTPURLProtocol . self )
255
+ let _ = URLSession . registerProtocols
252
256
}
253
257
254
258
open let delegateQueue : OperationQueue
You can’t perform that action at this time.
0 commit comments