Skip to content

Commit 0980651

Browse files
authored
New HTTP loader for URLSession (#5168)
1 parent d6aed57 commit 0980651

7 files changed

+14
-3
lines changed

Sources/Foundation/NSError.swift

+1
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@ extension URLError {
803803
}
804804

805805
/// The string for the URL which caused a load to fail.
806+
@available(swift, deprecated: 6.1, message: "Use failingURL instead")
806807
public var failureURLString: String? {
807808
return _nsUserInfo[NSURLErrorFailingURLStringErrorKey] as? String
808809
}

Sources/Foundation/NSURLError.swift

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public let NSURLErrorFailingURLErrorKey: String = "NSErrorFailingURLKey"
2020

2121
/// The `NSError` userInfo dictionary key used to store and retrieve the NSString
2222
/// object for the URL which caused a load to fail.
23+
@available(swift, deprecated: 6.1, message: "Use NSURLErrorFailingURLErrorKey instead")
2324
public let NSURLErrorFailingURLStringErrorKey: String = "NSErrorFailingURLStringKey"
2425

2526
/// The `NSError` userInfo dictionary key used to store and retrieve the

Sources/FoundationNetworking/NSURLRequest.swift

+2
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ open class NSURLRequest : NSObject, NSSecureCoding, NSCopying, NSMutableCopying
373373

374374
open internal(set) var httpShouldHandleCookies: Bool = true
375375

376+
@available(swift, deprecated: 6.1, message: "HTTP/1 pipelining has known compatibility issues, please adopt HTTP/2 and HTTP/3 instead")
376377
open internal(set) var httpShouldUsePipelining: Bool = true
377378

378379
open override var description: String {
@@ -573,6 +574,7 @@ open class NSMutableURLRequest : NSURLRequest {
573574
set { super.httpShouldHandleCookies = newValue }
574575
}
575576

577+
@available(swift, deprecated: 6.1, message: "HTTP/1 pipelining has known compatibility issues, please adopt HTTP/2 and HTTP/3 instead")
576578
open override var httpShouldUsePipelining: Bool {
577579
get { return super.httpShouldUsePipelining }
578580
set { super.httpShouldUsePipelining = newValue }

Sources/FoundationNetworking/URLProtectionSpace.swift

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public let NSURLProtectionSpaceHTTPS: String = "NSURLProtectionSpaceHTTPS"
2929
@const NSURLProtectionSpaceFTP
3030
@abstract The protocol for FTP
3131
*/
32+
@available(swift, deprecated: 6.1, message: "FTP is deprecated")
3233
public let NSURLProtectionSpaceFTP: String = "NSURLProtectionSpaceFTP"
3334

3435
/*!
@@ -47,6 +48,7 @@ public let NSURLProtectionSpaceHTTPSProxy: String = "NSURLProtectionSpaceHTTPSPr
4748
@const NSURLProtectionSpaceFTPProxy
4849
@abstract The proxy type for ftp proxies
4950
*/
51+
@available(swift, deprecated: 6.1, message: "FTP is deprecated")
5052
public let NSURLProtectionSpaceFTPProxy: String = "NSURLProtectionSpaceFTPProxy"
5153

5254
/*!

Sources/FoundationNetworking/URLRequest.swift

+1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ public struct URLRequest : ReferenceConvertible, Equatable, Hashable, Sendable {
224224
/// `true` if the receiver should transmit before the previous response
225225
/// is received. `false` if the receiver should wait for the previous response
226226
/// before transmitting.
227+
@available(swift, deprecated: 6.1, message: "HTTP/1 pipelining has known compatibility issues, please adopt HTTP/2 and HTTP/3 instead")
227228
public var httpShouldUsePipelining: Bool {
228229
get {
229230
return _handle.map { $0.httpShouldUsePipelining }

Sources/FoundationNetworking/URLSession/URLSessionConfiguration.swift

+6-3
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ open class URLSessionConfiguration : NSObject, NSCopying, @unchecked Sendable {
204204
*/
205205

206206
/* Allow the use of HTTP pipelining */
207+
@available(swift, deprecated: 6.1, message: "HTTP/1 pipelining has known compatibility issues, please adopt HTTP/2 and HTTP/3 instead")
207208
open var httpShouldUsePipelining: Bool
208209

209210
/* Allow the session to set cookies on requests */
@@ -229,9 +230,7 @@ open class URLSessionConfiguration : NSObject, NSCopying, @unchecked Sendable {
229230
/* The URL resource cache, or nil to indicate that no caching is to be performed */
230231
open var urlCache: URLCache?
231232

232-
/* Enable extended background idle mode for any tcp sockets created. Enabling this mode asks the system to keep the socket open
233-
* and delay reclaiming it when the process moves to the background (see https://developer.apple.com/library/ios/technotes/tn2277/_index.html)
234-
*/
233+
@available(swift, deprecated: 6.1, message: "Not supported")
235234
open var shouldUseExtendedBackgroundIdleMode: Bool
236235

237236
/* An optional array of Class objects which subclass URLProtocol.
@@ -253,6 +252,10 @@ open class URLSessionConfiguration : NSObject, NSCopying, @unchecked Sendable {
253252
@available(*, unavailable, message: "Not available on non-Darwin platforms")
254253
open var multipathServiceType: URLSessionConfiguration.MultipathServiceType { NSUnsupported() }
255254

255+
/* Uses the classic network loader */
256+
@available(*, unavailable, message: "Not available on non-Darwin platforms")
257+
open var usesClassicLoadingMode: Bool { NSUnsupported() }
258+
256259
}
257260

258261
@available(*, unavailable, message: "Not available on non-Darwin platforms")

Sources/FoundationNetworking/URLSession/URLSessionTaskMetrics.swift

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ open class URLSessionTaskMetrics : NSObject, @unchecked Sendable {
2929
public enum ResourceFetchType: Int, Sendable {
3030
case unknown = 0
3131
case networkLoad = 1
32+
@available(swift, deprecated: 6.1, message: "Server push is not supported")
3233
case serverPush = 2
3334
case localCache = 3
3435
}

0 commit comments

Comments
 (0)