Open
Description
Previous ID | SR-6406 |
Radar | None |
Original Reporter | p_thompson (JIRA User) |
Type | Bug |
Environment
Swift 4.0.2-Release on Ubuntu 16.04.3
Additional Detail from JIRA
Votes | 0 |
Component/s | Foundation |
Labels | Bug, RunTimeCrash |
Assignee | None |
Priority | Medium |
md5: bf90ed399248174c721a712a653ca69f
Issue Description:
When I open this url in a web browser, I get back a 6 byte text file with the contents "THINK\n". When I download it with a dataTask (or downloadTask), Swift gives me a fatal error instead.
Here is some code to reproduce the issue:
import Foundation
let configuration = URLSessionConfiguration.default
let session = URLSession(configuration: configuration)
// url1 works
let url1 = URL(string: "https://github.com/IBM-Swift/CArchive/raw/master/module.modulemap")!
//url2 generates a Fatal error
let url2 = URL(string: "https://store-test.blobstore.apple.com/test2/think.txt?AWSAccessKeyId=MKIAQ46TEN6NTFP8PJAP&SignatureMethod=HmacSHA1&SignatureVersion=2&Expires=64092211200&Signature=jgHl7aTtiJhkvSaRC19YaH2T2qo%3D")!
let dl_task = session.dataTask(with: url2) { (data, resp, err) in
print(String(data: data ?? Data(), encoding: .utf8) ?? "")
}
dl_task.resume()
RunLoop.main.run()