Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSURLSession - download and do *not* decompress gzip?

I'm using NSURLSession's dataTaskWithRequest to download a file. It's gzipped, and it is automatically decompressed. However, I don't want it to be - I want the gzipped source. Is there any way to disable decompression?

like image 285
Alastair Avatar asked Dec 08 '16 16:12

Alastair


1 Answers

NSURLSession automatically inserts this value to your request's header:

"Accept-Encoding: gzip;q=1.0, compress;q=0.5"

which causes the downloaded data to be automatically decoded. So I think you should start by replacing the value of "Accept-Encoding" with something else.

like image 163
arturdev Avatar answered Sep 25 '22 00:09

arturdev