Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to gzip an NSURLConnection request?

Apparently, NSURLConnection automatically decodes gzipped responses. But, can it gzip encode its requests? If so, how? Or, does it do this automatically too?

like image 398
ma11hew28 Avatar asked Jun 01 '11 15:06

ma11hew28


1 Answers

An HTTP request body cannot be gzipped at the protocol level, as there is no way for the client to know whether the server supports that or not; it works for the server response because the client indicates in the request whether a gzipped response body can be accepted. (It could be done in the future something like how Expect: 100-continue works, but that's not the situation we're faced with today).

At the application level, you certainly could gzip the request body. But that would be outside the realm of NSURLConnection.

like image 144
Anomie Avatar answered Sep 23 '22 18:09

Anomie