mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-25 01:01:21 +01:00
Start work on uploading the crash log. Create the URL request and the proper headers and form data.
This commit is contained in:
parent
299ffe93b6
commit
af65fd948b
@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import RSWeb
|
||||||
|
|
||||||
// Based originally on Uli Kusterer's UKCrashReporter: http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-one.htm
|
// Based originally on Uli Kusterer's UKCrashReporter: http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-one.htm
|
||||||
// Then based on the crash reporter included in NetNewsWire 3 and NetNewsWire Lite 4.
|
// Then based on the crash reporter included in NetNewsWire 3 and NetNewsWire Lite 4.
|
||||||
@ -93,7 +94,19 @@ struct CrashReporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static func sendCrashLogText(_ crashLogText: String) {
|
static func sendCrashLogText(_ crashLogText: String) {
|
||||||
// TODO
|
let request = NSMutableURLRequest(url: URL(string: "https://ranchero.com/netnewswire/crashreportcatcher.php")!, cachePolicy: .reloadIgnoringLocalAndRemoteCacheData, timeoutInterval: 60.0)
|
||||||
|
request.httpMethod = HTTPMethod.post
|
||||||
|
|
||||||
|
let boundary = "0xKhTmLbOuNdArY"
|
||||||
|
|
||||||
|
let contentType = "multipart/form-data; boundary=%@\(boundary)"
|
||||||
|
request.setValue(contentType, forHTTPHeaderField:HTTPRequestHeader.contentType)
|
||||||
|
|
||||||
|
let formString = "--\(boundary)\r\nContent-Disposition: form-data; name=\"crashlog\"\r\n\r\n\(crashLogText)\r\n--\(boundary)--\r\n"
|
||||||
|
let formData = formString.data(using: .utf8, allowLossyConversion: true)
|
||||||
|
request.httpBody = formData
|
||||||
|
|
||||||
|
// TODO: Implement one-shot-download method in RSWeb that takes a URL request.
|
||||||
}
|
}
|
||||||
|
|
||||||
static func runCrashReporterWindow(_ crashLog: CrashLog) {
|
static func runCrashReporterWindow(_ crashLog: CrashLog) {
|
||||||
|
Loading…
Reference in New Issue
Block a user