All-Seeing Interactive Logo

ASIHTTPRequest documentation

Last updated: 31st December 2008


v0.881 5th January 2009

Thanks to EgoAleSum and René Post for these!


v0.87 31th December 2008

  • Requests larger than 128KB will no longer timeout until more than 128KB of data has been uploaded. This is a workaround primarily targeted at apps running in low-bandwidth situations (eg: 3G / Edge on iPhone), where requests that took longer than the timeout to send 128KB of data (the upload buffer size) would always timeout, even if they had been sending data.
  • Related to the above: upload progress delegates now ignore the first 128KB of progress. You should no longer see a jump in progress at the beginning of a request, followed by no progress until more than 128KB had been sent.
  • Added POST progress example to the iPhone sample app
  • Removed debug code that could prevent UIProgressViews from updating
  • CFNetwork.h is now only imported when targeting iPhone, fingers crossed ASIHTTPRequest should now build cleanly on both platforms out of the box...

Many thanks to René Post for highlighting the first two issues!

v0.86 20th December 2008

  • Import CFNetwork header in ASIHTTPRequest.h so iPhone targets build in release configuration out of the box
  • Use removeItemAtPath rather than removeFileAtPath to get rid of a warning when targeting iPhone

Thanks to Jake Olefsky and Kiichi Takeuchi for these!

v0.85 9th December 2008

HEAD requests created by ASINetworkQueues to calculate accurate progress now reuse request headers (including authentication information and cookies) from their main request. Additionally, these HEAD requests will now set the error property of the main request, and call the main request's delegate, rather than their own, when an error is generated.

Thanks to Alex Reynolds for pointing out this bug!

v0.84 17th November 2008

  • Added the ability to pass an NSData object to ASIFormDataRequest as an alternative to a file path
  • Fixed a type conversion bug that could cause UIProgressViews to show progress incorrectly

Thanks to Roman Busyghin for pointing these out!

v0.82 12th November 2008

Reworked error system. Errors are now split into 7 types, see ASIHTTPRequest.h for the constants you can use in your code to find out what went wrong. Errors now use the standard NSLocalizedDescriptionKey in their userInfo dictionary.

v0.8: 11th November 2008

Made some major changes to the progress system and ASINetworkQueue.

ASIHTTPRequests and ASINetworkQueues now have a new property, showAccurateProgress. When turned on, requests will update the progress delegates to show the amount downloaded / uploaded so far (this was the previous behaviour). When turned off, they will only update the progress delegate when the request completes. The default is on for ASIHTTPRequests, but off for requests added to an ASINetworkQueue.

If you turn showAccurateProgress on for an ASINetworkQueue, the queue will perform HTTP HEAD requests for every GET request in the queue before any downloads begin. This allows the queue to calculate the total size to download before any downloads take place, and should stop progress indicators jumping backwards and forwards. It’s probably best to leave showAccurateProgress off for ASINetworkQueues unless you have very large requests or the size of requests varies greatly, to avoid the overhead of the HEAD requests.

For POST requests, ASINetworkQueues now call buildPostBody on each request when showAccurateProgress is on. The default implementation is empty, but subclasses are expected to have a complete request body (setPostBody) by the time this method completes. This is so ASINetworkQueues can gather the total size of upload requests before they begin, again to provide a more accurate indication of progress. Previously, building the post body was part of the main method that ran just before the request was loaded. ASIFormDataRequest uses setPostBody to create the post content, see that class for an example.

It is now necessary to call go on a ASINetworkQueue to start it. This is so the queue can reset the progressDelegates when necessary.

Both the Mac and iPhone sample apps now have a checkbox to turn accurate progress on and off in the ‘queue’ examples, so you can get an idea how it works.

Locking behaviour has been revised to fix a few deadlocks, and you no longer need to worry about the whole thing grinding to a halt when the main thread is busy (eg with waitUntilAllOperationsAreFinished).

Finally, there are a couple of new tests for authentication.

v0.7: 8th November 2008

ASIHTTPRequest has had a major overhaul with lots of new features, including iPhone support and progress tracking for multiple requests. If you are already using an older version of ASIHTTPRequest, you may need to make changes to your code.

You can read about some of the new stuff here.