NSURLSession - download and do *not* decompress gzip?

扶醉桌前 提交于 2019-12-06 03:35:46

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/41044239/nsurlsession-download-and-do-not-decompress-gzip

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!