mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add User-Agent header.
This commit is contained in:
@@ -13,12 +13,19 @@ import os
|
||||
|
||||
public protocol DownloadSessionDelegate: AnyObject {
|
||||
|
||||
// DownloadSession will add User-Agent header to request returned by delegate
|
||||
@MainActor func downloadSession(_ downloadSession: DownloadSession, requestForIdentifier: String) -> URLRequest?
|
||||
|
||||
@MainActor func downloadSession(_ downloadSession: DownloadSession, downloadDidCompleteForIdentifier: String, response: URLResponse?, data: Data?, error: Error?)
|
||||
|
||||
@MainActor func downloadSession(_ downloadSession: DownloadSession, shouldContinueAfterReceivingData: Data, identifier: String) -> Bool
|
||||
|
||||
@MainActor func downloadSession(_ downloadSession: DownloadSession, didReceiveUnexpectedResponse: URLResponse, identifier: String)
|
||||
|
||||
@MainActor func downloadSession(_ downloadSession: DownloadSession, didReceiveNotModifiedResponse: URLResponse, identifier: String)
|
||||
|
||||
@MainActor func downloadSession(_ downloadSession: DownloadSession, didDiscardDuplicateIdentifier: String)
|
||||
|
||||
@MainActor func downloadSessionDidComplete(_ downloadSession: DownloadSession)
|
||||
}
|
||||
|
||||
@@ -207,6 +214,8 @@ private extension DownloadSession {
|
||||
}
|
||||
}
|
||||
|
||||
requestToUse.addValue(UserAgent.fromInfoPlist, forHTTPHeaderField: HTTPRequestHeader.userAgent)
|
||||
|
||||
let task = urlSession.dataTask(with: requestToUse)
|
||||
|
||||
let info = DownloadInfo(identifier, urlRequest: requestToUse)
|
||||
|
||||
Reference in New Issue
Block a user