ASIHTTPRequest + GZip

Shaun, Jan 9

One of the 3rd party class sets we use in all of our iPhone apps as well as QuickShareIt is ASIHTTPRequest. It's an awesome Objective-C wrapper around the Carbon network functions from Apple. Ben from All-Seeing Interactive wrote it, and you can grab it here: http://allseeing-i.com/ASIHTTPRequest

We realized while writing our new iPhone app that ASIHTTPRequest didn't support GZip compressed content, which is pretty common on the web and drastically speeds up the iPhone when pulling it. This really should of been something we noticed with Reader, but we somehow let it slip by, and it will definitely be in the next version of Reader to provide great speed improvements.

Anyway, we subclassed ASIHTTPRequest to provide both content-type detection (for UTF8 vs ASCII) and GZip support with the help of a NSData Gzip compression method from our friends at Deusty.

Here it is:


The only other thing you'll need to do is make sure you add the libz library to your project, and include it at the top of your subclass:

#include <zlib.h>

Shaun

blog comments powered by Disqus