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

New HTTP loader for URLSession #5162

Merged
merged 1 commit into from
Feb 10, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/Foundation/NSError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ extension URLError {
}

/// The string for the URL which caused a load to fail.
@available(swift, deprecated: 6.1, message: "Use failingURL instead")
public var failureURLString: String? {
return _nsUserInfo[NSURLErrorFailingURLStringErrorKey] as? String
}
Expand Down
1 change: 1 addition & 0 deletions Sources/Foundation/NSURLError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public let NSURLErrorFailingURLErrorKey: String = "NSErrorFailingURLKey"

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

/// The `NSError` userInfo dictionary key used to store and retrieve the
Expand Down
2 changes: 2 additions & 0 deletions Sources/FoundationNetworking/NSURLRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ open class NSURLRequest : NSObject, NSSecureCoding, NSCopying, NSMutableCopying

open internal(set) var httpShouldHandleCookies: Bool = true

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

open override var description: String {
Expand Down Expand Up @@ -573,6 +574,7 @@ open class NSMutableURLRequest : NSURLRequest {
set { super.httpShouldHandleCookies = newValue }
}

@available(swift, deprecated: 6.1, message: "HTTP/1 pipelining has known compatibility issues, please adopt HTTP/2 and HTTP/3 instead")
open override var httpShouldUsePipelining: Bool {
get { return super.httpShouldUsePipelining }
set { super.httpShouldUsePipelining = newValue }
Expand Down
2 changes: 2 additions & 0 deletions Sources/FoundationNetworking/URLProtectionSpace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public let NSURLProtectionSpaceHTTPS: String = "NSURLProtectionSpaceHTTPS"
@const NSURLProtectionSpaceFTP
@abstract The protocol for FTP
*/
@available(swift, deprecated: 6.1, message: "FTP is deprecated")
public let NSURLProtectionSpaceFTP: String = "NSURLProtectionSpaceFTP"

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

/*!
Expand Down
1 change: 1 addition & 0 deletions Sources/FoundationNetworking/URLRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public struct URLRequest : ReferenceConvertible, Equatable, Hashable, Sendable {
/// `true` if the receiver should transmit before the previous response
/// is received. `false` if the receiver should wait for the previous response
/// before transmitting.
@available(swift, deprecated: 6.1, message: "HTTP/1 pipelining has known compatibility issues, please adopt HTTP/2 and HTTP/3 instead")
public var httpShouldUsePipelining: Bool {
get {
return _handle.map { $0.httpShouldUsePipelining }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ open class URLSessionConfiguration : NSObject, NSCopying, @unchecked Sendable {
*/

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

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

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

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

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

}

@available(*, unavailable, message: "Not available on non-Darwin platforms")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ open class URLSessionTaskMetrics : NSObject, @unchecked Sendable {
public enum ResourceFetchType: Int, Sendable {
case unknown = 0
case networkLoad = 1
@available(swift, deprecated: 6.1, message: "Server push is not supported")
case serverPush = 2
case localCache = 3
}
Expand Down