Skip to content

Instantly share code, notes, and snippets.

@pizthewiz
pizthewiz / gist:1121036
Created August 2, 2011 19:47 — forked from mikeash/gist:837409
Block-based URL connection
// NSURLConnection wrapper
// like NSURLConnection, requires a runloop, callbacks happen in runloop that set up load
@interface LDURLLoader : NSObject {
NSURLConnection* _connection;
NSTimeInterval _timeout;
NSTimer* _timeoutTimer;
NSURLResponse* _response;
long long _responseLengthEstimate;
NSMutableData* _accumulatedData;
void (^_timeoutHandler)(void);