Please note that I am no longer working on this library - you may want to consider using something else for new projects. :)

ASIHTTPRequest documentation

Last updated: 15th May 2011 (v1.8.1)

ASIHTTPRequest changelog

v1.8.1 28th May 2011

v1.8.1 is a maintenance update that includes lots of bug fixes and several small new features. As ever, thanks to everyone who has contributed code, bug reports and feature requests!

ASIDownloadCache

  • ASIDownloadCache is now significantly faster at deciding if cached data is still current (many thanks to Matthias Tretter for the bug report!), and won’t waste time rewriting previously cached data when it encounters a 304/Not modified.
  • ASIDownloadCache now caches HTTP 301, 302, 303 and 307 responses (HTTP redirects). When a request pulls data from the cache and encounters a cached redirect response, it will redirect as if it had received a Location header from the server. This includes calling the delegate’s willRedirectSelector to ask if a redirect should take place, and the delegate’s requestRedirected method, if implemented. This change should allow the cache to operate more effectively as a fallback when no internet connectivity is available. Many thanks to Jorge for the request!
  • Added removeCachedDataForURL: to ASICacheDelegate and ASIDownloadCache. Thanks to Ole Gammelgaard Poulsen for requesting this!
  • Several new required methods have been added to the ASICacheDelegate protocol, see ASICacheDelegate.h for more info. If you have implemented your own cache, you will need to update your code.

Persistent connections

  • ASIHTTPRequest will by default no longer use persistent connections for requests that contain a body (eg POST/PUT). This change is to match browser behaviour and should help improve reliability with servers that don’t send a keep-alive header. You can override this behaviour by setting your request method manually, then turning persistent connections back on.
  • Fixed a problem where a temporary request body (such as one generated by ASIFormDataRequest) would be discarded when a request encounters a closed connection and is forced to retry. Many thanks to Cédric Deltheil and Slyv for their help in tracking this down!

Authentication

  • When a username and password are set on a request, and shouldPresentCredentialsBeforeChallenge is true, ASIHTTPRequest will no longer send a Basic authentication header on the very first request unless the request’s authenticationScheme has been manually set to Basic:
    [request setAuthenticationScheme:(NSString *)kCFHTTPAuthenticationSchemeBasic];
    This resolves problems with servers using one of the other authentication schemes. Many thanks to Cédric Deltheil for the report and fix!
  • ASIHTTPRequest should now favour credentials set on the request over those stored in the session where the two are different, for all authentication schemes. Previously, under certain authentication schemes, requests would have reused session credentials when replacement credentials were supplied on the request.
  • Added a new debug option to ASIHTTPRequestConfig.h. When enabled, DEBUG_HTTP_AUTHENTICATION prints out information about HTTP authentication to the console.

Miscellaneous changes and fixes

  • PAC files are now downloaded asynchronously by having requests create a child request to obtain the PAC file. PAC files from local file:// URLs are read using an asynchronous NSInputStream. This should help resolve problems with PAC files that are unavailable, and PAC file downloads should inherit their parent request’s time out.
  • Added [request tag], an integer property you can use as an alternative to setting userInfo. As with userInfo, this is for your own use, and is not sent to the server. Thanks to Ricardo1980 for requesting this!
  • Requests that have finished downloading the response no longer clear the response contents or response headers when they fail with an error. This means it is now possible to access the response body if requests fail authentication. Many thanks to ericcxu and Johan Karlsson for requesting this!
  • Fixed a couple of zlib issues with ASIDataCompressor and ASIDataDecompressor (many thanks to Alex Deem, JoeBlaze and Daniel Rhodes!)
  • Fixed some problems that could occur with non-ASCII user agents (Many thanks to MaximKeegan for the fix!)
  • Fixed a small leak in ASIWebPageRequest. Thanks to Averello for the report!
  • The HTTPS error message has been updated with a hint about a wrong device date being a possible cause. Thanks to Ole Gammelgaard Poulsen for suggesting this!
  • Block callbacks are now always called after delegate callbacks, but before queue callbacks. Thanks to all who requested a different order, and Arlo Borras for the code!
  • Removed some old cruft from ASIDataCompressor and ASIDataDecompressor (thanks to Jon Parise!)
  • Fixed some misleading comments in various places (Thanks to Cédric Luthi for this!)
  • Requests now check if cached data is available when encountering an error and using ASIFallbackToCacheIfLoadFailsCachePolicy. If there is no cached data, the request will fail with an error. (Many thanks to Erik von Harten!)
  • ASIWebPageRequest should parse HTML using the correct encoding (Thanks to Cédric Luthi!)
  • Fixed a problem where ASIAuthentication dialog could fail to disappear when dismissed on iPad (Thanks to Marcin Dawid for the bug report!)
  • ASIHTTPRequest can now read the NTLM domain from the request URL if no domain has been supplied manually. Thanks to Sasmito Adibowo for the code!
  • Fix some problems that could prevent data being cleared from the cache (Thanks to Anton Holmquist for the report!)
  • ASIDownloadCache now parses max-age from Cache-Control headers more reliably, and max-age takes precedence over any Expires header (Thanks to Anton Holmquist for the fixes!)
  • Various classes no longer user NSFileManager’s defaultManager because it is not thread-safe (Thanks to LeeMatthewHiggins!)
  • Fixed typos in error messages (Thanks to Dav Yaginuma!)
  • Fixed some locking issues with ASIDownloadCache (Thanks to LeeMatthewHiggins and judev!)
  • ASIDownloadCache no longer uses a cached response if the server doesn’t send any expiry information (Thanks to Philippe Jayet!)
  • Rename various method parameters to avoid clang warnings about conflicts (Thanks to Tim Shadel for the fixes!)
  • Fixed a nasty problem that would have resulted in requests stealing each other’s connections in certain very rare circumstances. A big thank you to TeunVR for finding this one and providing the fix!
  • Fixed a small issue in ASIDownloadCache that caused static analyser warnings - thanks to all who reported this, including Peter Jihoon Kim, Geoff Buesing and Graham Lee.
  • Synchronous requests no longer make any pretence at supporting delegate authentication or ASIAuthenticationDialog. The documentation previously implied that this may have been supported, but it didn’t work. Requests should no longer ask their delegates or credentials or display authentication dialogs. Many thanks to csdillard for reminding me to look at this!
  • Fixed a minor issue with ASIAuthenticationDialog storing orientation in the wrong way (Thanks to Peter Steinberger for the fix!)
  • Fixed a casting problem that would cause throttling to stop working for certain values of maxBandwidthPerSecond - many thanks to tianzhou for this fix!
  • GHUnit is no longer included as a submodule. Instead, build scripts are used to fetch a pre-compiled GHUnit framework for Mac or iOS if one does not exist in External/GHUnit (though if you build your own, put it here and it should work). Hopefully this should make it easier to run the tests.
  • Fixed one or two strict compiler warnings

v1.8 13th November 2010

Yet another giant update! A lot of people have contributed bug reports, feature requests and code for this release - my apologies if I’ve missed anyone!

I’d like to say a special thank you to Joseph Heenan for all his work fixing some long-standing problems with delegate calls, and to Jamie Pinkham and Peter Steinberger for making blocks support finally happen. Thanks very much!

ASIWebPageRequest (Experimental)

This new class allows you to download complete webpages by creating a single request. External resources can be embedded directly into HTML and CSS (using data URIs), or stored separately on disk. Complete, locally-cached webpages can be loaded into a UIWebView / WebView.

For more information on ASIWebPageRequest, see the documentation.

Blocks support

You can now use blocks with ASIHTTPRequest to handle callbacks instead of delegates. Most delegate calls have a block you can set as an alternative. It is possible to mix and match delegate and block calls, and in most cases where both a delegate and block callback are set, both will be called. ASIHTTPRequest always runs blocks on the main thread, just like delegate method calls.

There’s a simple example of basic blocks usage with ASIHTTPRequest here.

A thousand thanks to Jamie Pinkham and Peter Steinberger for all their work on this!

ASIDownloadCache

ASIDownloadCache has been significantly improved in this release. Cache policies are more flexible and the default cache policy is more sensible. I’m afraid I’ve had to change the API for ASIDownloadCache to accomodate these changes, so you will need to make changes in your app. For more information on the revised ASIDownloadCache, see the updated documentation.

Many thanks to everyone who provided feedback on caching in ASIHTTPRequest!

Background task support on iOS 4+

There’s now an easy way to tell requests you want them to continue running when your app enters the background on iOS 4 devices - set shouldContinueWhenAppEntersBackground to YES. Thanks to everyone who requested this, and especially to Russell Quinn for reminding me about it, and Luke Redpath for his bug fix.

On-the-fly gzip decompression

ASIHTTPRequests can now inflate (decompress) gzipped content as it is received. This means it is now possible to use a streaming XML / JSON parser with gzipped content with request:didReceiveData:. Hopefully this should also result in a small speed boost for any gzipped response. To enable this feature, set the request’s shouldWaitToInflateCompressedResponses to NO.

As part of the work on this, I’ve taken the gzip-functionality out of ASIHTTPRequest and put it into two separate helper classes, ASIDataCompressor and ASIDataDecompressor.

Many thanks to everyone who has asked for something similar (most recently, Dimitris Tsitses)!

Client certificates support

ASIHTTPRequest now supports client certificates. See the documentation for details on how to use them. Many thanks to Philipp Schmid for the code, and to all who requested this, particularly Alan D.

Other fixes and changes

  • Fixed some tricky, long standing issues with cancelling requests. Many thanks to Joesph Heenan for all his work on this!
  • Fixed some bugs that would have caused problems in garbage-collected Mac applications. Thanks to everyone who reported problems with GC, and especially to Matt Mower and Joseph Heenan for their sage advice on this!
  • Requests now have a new clearDelegatesAndCancel method, which clears all delegates and blocks, then cancels the request.
  • Added new request:willRedirectToURL: delegate method to allow delegates to override the url or cancel when a request redirects. Thanks to Colin Humber for the request!
  • requestReceivedResponseHeaders: is now request:didReceiveResponseHeaders:
  • Fixed a problem where changing a request’s url in certain delegate methods (eg authenticationNeededForRequest:) would cause it to fail
  • Private APIs used in the iPhone / iPad sample project no longer show warnings (Thanks to Zach Drayer for the code!)
  • Static errors are created retained, rather than autoreleased then retained (Thanks again to Zach Drayer!)
  • Fixed some static analyzer warnings (Thanks to Alan Rogers and Vadim Shpakovski!)
  • Requests that don’t run on the main thread should now reliably hide the network activity indicator on iOS. Thanks to everyone who reported this, including marklehmacher and Alistair!
  • ASIDownloadCache now correctly removes cached headers when removeCachedDataForRequest: is called (Thanks to Taggart Gorman for catching this!)
  • ASIDownloadCache now stores its data in the NSCachesDirectory rather than the NSTemporaryDirectory (because files stored in NSTemporaryDirectory are automatically removed after 3 days). Many thanks to Dincho Todorov for pointing this out!
  • Requests now re-use their ‘Accept’ headers when redirecting. Thanks to everyone who provided a patch for this, and especially to Sam Soffes, whose change ended up being the one I went with.
  • ASIHTTPRequest now correctly uses the appropriate constant for reachability change notifications (Thanks to Eric Chamberlain for the code!)
  • Requests should no longer call their didFinish selector twice when using a cache (Many thanks to Philippe Jayet for reporting this!)
  • Requests now ignore any previously downloaded content when attempting to resume a download if the response contains no Range header. Thanks to Martijn The for the bug report!
  • Fix some problems with resuming downloads and using automatic timeout retries. Many thanks to Max for finding this!
  • Requests now have cookies and their proper responseEncoding set when they are pulled from a cache. Many thanks to Andrea De Paoli for the fix!
  • Various fixes to ASIAuthenticationDialog. Thanks again to nanotech for the code, and thanks to Patrick Thompson for the bug report!
  • Fixes to make SOCKS proxies work properly - thanks very much to Sylver Bruneau for the report and code!
  • ASIHTTPRequests now ask the cache for the response data, rather than reading directly from the cached file path, when using a download cache without a downloadDestinationPath set. This should make things work better if you’ve implemented a custom, in-memory cache. Many thanks to jfmorin for the bug report!
  • ASIHTTPRequest no longer supports iOS 2.x

S3 Changes

  • Added support for S3 over HTTPS
  • Re-organise the code that builds the URL, which should hopefully make it easier to create subclasses to talk to other services with an S3-like API
  • Added more constants for the standard access policies
  • Added support for S3 storage classes (Thanks to romulusx for the request and bug fix!)

Thanks yet again to Tom Andersen for his work on S3 stuff!

v1.7 26th June 2010

Another gigantic update!

iOS 4

ASIHTTPRequest should be compatible with iOS 4, but please do report any issues you find.

Having said that, a warning: NTLM appears to be broken in the iOS 4 SDK, and it does not appear to be possible to perform a post using NTLM. There is a workaround here, but if NTLM is important to your app, you may prefer to continue to use the 3.x SDK for the time being.

ASIDownloadCache + ASICacheDelegate

Added new ASIDownloadCache class to handle caching responses for later use. Data is cached according to policies you set globally or per-request, and ASIHTTPRequests will automatically store data in and use data from the cache when you turn it on. There’s also a new ASICacheDelegate protocol you can use to write your own cache. See the new section in the documentation on caching for more information. Thank you to everyone who requested this!

Revised threading model

ASIHTTPRequest now runs all asynchronous requests (those started with startAsychronous or added to an ASINetworkQueue or NSOperationQueue) on a single, long living thread. This should reduce the overhead of creating and destroying threads, and ASIHTTPRequest should not block GCD queues. There’s also a new mechanism for changing the threading behaviour if you so desire. This is partly based on the replacement ASINetworkQueue experiment I wrote about a few weeks ago, but the implementation is simpler, and, best of all, the API is identical to the old version, so you shouldn’t need to change anything. ASINetworkQueue is more or less unchanged, though ASIHTTPRequests started with startAsynchronous now run in a global NSOperationQueue again (as they did previous to v1.5). This means that requests started with startAsynchronous are now queued behind the scenes so that no more than 4 of them run at once.

I am very grateful to the Apple Engineers I spoke to at WWDC who convinced me to stick with NSOperation and provided lots of helpful advice and insight. I’d also like to say a big thank you to Keith Duncan, whose advice has been extremely helpful, and provided the final prod I needed to get this done. Many thanks!

ASIFormDataRequest

ASIFormDataRequests can now send multiple values for the same parameter using the new addPostValue:forKey: addFile:forKey: and addData:forKey: methods. Thanks to everyone who requested this!

ASIAuthenticationDialog

ASIAuthenticationDialog should now be compatible with iOS4 and iPad, and it supports both portrait and landscape orientations. Many thanks to nanotech for all the hard work on this!

Also, ASIAuthenticationDialog now smarter about queuing up requests asking for credentials to be displayed in subsequent dialogs, and reusing supplied credentials for requests that need to authenticate in the same realm.

Reachability

ASIHTTPRequest now uses (and includes) Andrew Donoho’s replacement for Apple’s Reachability class. It should be compatible with all versions of the SDK, and removes all the confusion over which version to include. Thanks to everyone who suggested this, including Andrew himself!

Plus, loads more bug fixes and tweaks:

  • The iPhone sample app has had some big changes, and there’s a new target for iPad that shares most of the code. Currently the sample apps for iPhone and iPad are a little bit rough around the edges, but I hope I’ll be able to fix some of the small issues and expand the samples to cover more features soon.
  • ASIHTTPRequest now updates the network activity indicator itself, rather than relying on the queue to do it. This means any request can automatically update the indicator regardless of how it is started and it works even when you have more than one queue. There’s a new class method to disable updating the network activity indicator (setShouldUpdateNetworkActivityIndicator:), and an additional class method (isNetworkInUse, also available on Mac OS), that is fairly self-explanatory.
  • Mac apps built with Garbage Collection should no longer leak Core Foundation objects. Many thanks to Jakub Suder for finding the problem and explaining the fix!
  • HEAD requests created by a queue or calling [request HEADRequest] now copy the appropriate properties from the original request. This should prevent problems with requests that certificate validation, among other things. Thanks to Chris for catching this!
  • Requests now preserve their user agent when they redirect. Thanks to uprise78 for the bug report!
  • ASIHTTPRequest and ASIFormDataRequest now create mutable copies of their properties where appropriate. This prevents NSInternalInconsistencyExceptions when running a copied request. Many thanks to Nebil for the fix!
  • Fixed a crash that could occur in markAsFinished. Thanks to Ryan Dary and sockettrousers for picking this up!
  • Fixed some warnings about mismatched types when building for Mac with Garbage Collection. Many thanks to Jakub Suder for highlighting this!
  • Regular HTTP connections should now work when validatesSecureCertificate is set to NO. Thanks to everyone who reported this, especially einsteinx2!
  • Fix a bug where requests to URLs containing a port number could cause exceptions when finding credentials to use from the session store. Many thanks to Luke Redpath for tracking this down!
  • ASIFormDataRequests no longer send a charset as part of the mime header for binary data, this caused problems with some servers. Thanks to Greg Maletic and everyone else who reported this!
  • Fixed a problem where the queue delegate would not be alerted when the request received response headers. Thanks to Ben Clayton for the fix!
  • Fixed a bug where requests connecting to an NTLM server via a proxy would not apply the credentials to the request properly.
  • Fixed a problem where the wrong delegate was notified when the download size changed (Thanks to zaytsev for catching this!)
  • Fixed a deprecation warning on iOS4 (Thanks to dirk and others who reported this!)
  • Fixed a bug in the iPhone sample that would have prevented it working on the device (Thanks to György Varró for the bug report!)
  • Tweaks to conditional compilation will hopefully result in less warnings.
  • Fixed some crashes that may have occurred when cancelling requests. Many thanks to Alex Reynolds for picking this up!
  • Removed the legacy ASINSStringAdditions category
  • Various improvements to the documentation

S3 and CloudFiles:

  • ASIS3Request and ASICloudFilesRequest now only share date formatters on the same thread
  • Various fixes to S3

Thanks once again to Tom Andersen for all his hard work fixing problems with S3!

v1.6.2 15th April 2010

Progress tracking updates and new protocols

Progress tracking code has had some major changes to add functionality, fix bugs, and improve the code. Some of the more visible changes:

  • Added new ASIProgressDelegate protocol. Progress delegates now have two ways to receive progress updates - setProgress: (setDoubleValue: on Mac OS X), and request:didReceiveBytes: / request:didSendBytes:. The latter approach will probably be most helpful to those implementing custom progress delegates.
  • shouldResetProgressIndicators has been removed and replaced with two new properties - shouldResetUploadProgress / shouldResetDownloadProgress
  • Improved behaviour so that resuming downloads shouldn’t cause progress bars to temporarily reset (Thanks to Matt Coneybeare for his report!)

Additionally, there’s a new ASIHTTPRequestDelegate protocol to help formalise the delegate methods. There are two new delegate methods:

- (void)requestReceivedResponseHeaders:(ASIHTTPRequest *)request;
- (void)request:(ASIHTTPRequest *)request didReceiveData:(NSData *)data;

request:didReceiveData: allows you to handle response data as it arrives without subclassing. Note that when you do this, the request will not populate responseData, or write data to disk itself - you are expected to handle the data in your implementation of this method.

S3

Made lots of small changes to the S3 API to fix bugs, reduce duplication, and add a couple of new things. A few of the most important changes:

  • ASIS3BucketRequest - [request bucketObjects] is now [request objects]
  • ASIS3ServiceRequest - [request allBuckets] is now [request buckets]
  • ASIS3BucketRequest now has new properties: commonPrefixes, and isTruncated

My thanks to Tom Andersen for all his work on this!

Other changes

  • Fixed an issue that may have prevented apps connecting via a proxy using HTTPS. Thanks to Mihail Merkulov for the fix!
  • initWithURL: now calls [self init] rather than [super init], which should allow subclasses to override behaviour in init. Many thanks to Nathan de Vries for pointing this out!
  • Fix some problems with ASIInputStream that caused ASIHTTPRequest to break when used with MacRuby. Thanks to Thibault Martin-Lagardette for the patch!
  • Fixed a potential locking issue when retrying a request after a dropped connection (Thanks to Jason Brown for helping me catch this!)
  • Synchronous requests now run in a custom run loop mode again to ensure synchronous requests on the main thread properly block the UI

v1.6.1 24th March 2010

  • S3: The API for Amazon S3 has had some major revisions. I’ve broken it up into smaller, more logical classes, and added support for service operations (listing buckets), as well as creating and deleting buckets. See the updated documentation here. Many thanks to all who requested additions to the S3 API, most recently Matt Long, and Laurence Koret!
  • S3: S3 classes no longer require you to url-encode your S3 keys for object requests (the updated classes will do this for you), and keys shouldn’t need to start with a forward slash. Many thanks to Tom Andersen for his bug report and code!
  • S3: S3 classes now handle ‘connection closed’ errors from the S3 service, and automatically retry requests once when they encounter a closed connection.
  • Mime-type detection (used by ASIFormDataRequest, and ASIS3Request) now works on iPhone OS. To make this work, it is now necessary for iPhone apps to link with MobileCoreServices. On Mac OS, mime type detection no longer requires spawning an NSTask.
  • Requests now automatically retry once when they encounter ‘connection lost’ or ‘broken pipe’ errors.
  • The default expiry for persistent connections is now configurable with the new persistentConnectionTimeout property. If a server sends a keep-alive header with information on how long to keep connections open, the value from the server will override this. Many thanks to Jimmy Thrasher for his patch!
  • Fixed the iPhone sample project to use the corrected spelling for ‘persistence’
  • GHUnit is now included as a git submodule rather than a pre-compiled framework / static lib. If you want to run the tests, see the updated instructions here.

v1.6 2nd March 2010

Another big update!

Most importantly, this release includes full support for Rackspace Cloud Files! There’s a guide to get you started here.

I am extremely grateful to Mike Mayo for taking the time to contribute support for Cloud Files. Many thanks, Mike!

There’s also lots of other fixes an improvements:

  • Lots of improvements and bug fixes to solve problems with persistent connections
  • Resuming downloads now works properly for responses that redirect. ASIHTTPRequests will ignore the bodies of 30x redirect responses, and only save the body from the final (non-redirecting) response. Thanks to Matt Coneybeare and Martijn Thé for their bug reports!
  • ASIHTTPRequests (finally) now have an originalURL property that stores the original url used for the request. This may be useful in your delegate methods when a request redirects. Thanks to Martijn Thé, and everyone else who has requested this in the past! Also, thanks to Justim Odendaal for pointing out the leak in the original implementation!)
  • Added shouldUseRFC2616RedirectBehaviour property. When set to true, requests will reuse their requests method and body when they encounter a 301 or 301 response status, matching the standard behaviour in RFC2616. This is not the default behaviour - by default, 301 and 302s are redirected as GET requests with no body to match the behaviour implemented by most browsers.
  • ASINetworkQueues will now call their queue finished delegate when one of the requests in the queue fails. Thanks to mads86 for the bug report!
  • ASIHTTPRequest no longer requires the server to send a ‘Keep Alive’ header to use persistent connections. All connections should now be reused unless persistent connections are disabled, the server is using http 1.0 and doesn’t send the keep alive header, or the server tells us to close the connection. Many thanks to Steven Hugg for his bug report!
  • Fix a problem where URLs created with URLWithString:relativeToURL: would sometimes fail to read cookies from the shared store. Thanks to Suraj for reporting the problem and suggesting the fix!
  • Fix a problem that may have prevented requests that redirect being cancelled. Thanks to Matt Coneybeare for his report!
  • ASIFormDataRequest will now only change the request method to POST if it is one of GET, HEAD, DELETE. This allows ASIFormDataRequests to use PUT. Many thanks to Sam Soffes for pointing out this problem!
  • You can now use [ASIHTTPRequest setDefaultTimeOutSeconds:x] to change the default timeout. Many thanks to Steven Osborn for his request!
  • Added support for HTTP 307 redirects (305 Use Proxy redirects are still not supported).
  • Fixed a potential deadlock with redirecting requests
  • Use conditional compilation to choose a suitable API for adding a timeinterval to a date. Thanks to Dave Verwer for pointing out the problem!
  • DEBUG_REQUEST_STATUS now prints more information about the status of a request
  • Fix a crash that would have occurred when DEBUG_REQUEST_STATUS was on, caused by passing arguments to NSLog in the wrong order. Many thanks for Darren Clarke his fix!
  • ASIHTTPRequestConfig.h now wraps its settings in #ifndefs to allow overriding in your build config. Many thanks to Duane Fields for this!
  • Fix some clang warnings. Thanks to Christopher Atlan for the code!
  • Fix a regression that broke download progress.
  • Fixed the mispelling of ‘persistence’ that unfortunately spread through the API like a rash. My apologies for all the breakage this is bound to cause... :)

v1.5 6th January 2010

This is a giant update, with a particular focus on improving performance. Read more about this release here.

  • ASIHTTPRequests are now ‘concurrent’ NSOperations. This should result in lower CPU use, and slightly better performance. Additionally, it provides extra flexibility - asynchronous ASIHTTPRequests can now be run in the main thread (without a queue).
  • Added support for persistent HTTP connections. This should result in a significant performance boost for applications that perform many small requests to the same server. Many thanks to Christoph Ludwig for the suggestion!
  • ASIHTTPRequest, ASIFormDataRequest, ASINetworkQueue, ASIS3Request, ASIS3ListRequest and ASIS3BucketObject all now implement the NSCopying protocol. Copies of requests only include the values of properties that can be used to repeat the request using the copy.
  • ASIHTTPRequests now have a ‘numberOfTimesToRetryOnTimeout’ property. When set, a request will automatically restart itself that number of times if it times out. Thanks to Max Horváth, Wiktor Gworek, and Bill Tschumy for their requests!
  • Bandwidth throttling should be more reliable, and less likely to cause timeouts when performing many requests at once
  • ASIHTTPRequest now supports (and includes) two versions of Apple’s Reachability class. See the instructions in ASIHTTPRequestConfig.h for details on how to select the one to use. Many thanks to everyone who requested support for Reachabilty 2.0, and especially to everyone who sent code, particularly Christoph Ludwig, upon whose patch this work was based!
  • Added PUTRequestForData:withBucket:path: to ASIS3Request. This allows data in memory to be stored on Amazon S3. Thanks to rpstro02 for the request!
  • Requests now have a didStartSelector property. This selector will be called on your delegate when a request starts. Many thanks to coium.com for the code!
  • Redirect behaviour for HTTP 301 and 302 status codes has been changed. When encountering a 301 or 302 status code, requests will redirect with a GET request. This change means ASIHTTPRequest mimics the way browsers work, rather than conforming to the HTTP spec. Scott Guelich was the most recent person to request this change, many thanks!
  • ASIHTTPRequest now downloads the full response regardless of the headers it gets back. Previously, it would stop when authentication was required, or it needed to redirect.
  • The appropriate API for progress delegates (NSProgressIndicator or UIProgressView) is now chosen at compile-time rather than at run time. Though iPhone OS apps would not have used it, setMaxValue: is apparently a private API. Many thanks to Shaun Harrison for highlighting this problem!
  • When using an ASINetworkQueue with accurate progress, delegates are now correctly notified of problems when the automatically created HEAD request fails. Thanks to Hermes Pique for his bug report!
  • Added a stricter build configuration, based on changes by Maarten Billemont (Thanks!)
  • Requests will assume no proxy when reading from the PAC url fails. Thanks to Dickson Ding for the report, and Wiktor Gworek for figuring out the problem!
  • ASIHTTPRequest now has a version string in the form ‘v1.2-67 YYYY-MM-DD’ baked into it, it is set on build if nescessary, and reflects the number of commits since the last tag, rather than being a traditional build number.
    NSLog(@"%@",ASIHTTPRequestVersion);
    will print it to the console. Many thanks to Thomas Weisbach for his suggestion!
  • Fixed an issue where POST/PUT requests with an empty body would timeout (Thanks to Steven Osborn for his report!)
  • Improved the progress behaviour of ASINetworkQueues when adding requests to a queue that has already been started
  • ASIHTTPRequest now includes various options for printing debug output to the console. See ASIHTTPRequestConfig.h for details.
  • Added a workaround for an issue with Apache where a HEAD request for dynamically generated content delivered with gzip will return an erroneous content-length
  • Fix some issues with download progress when the response does not include a content-length header.
  • Stop including stress tests in the example project target. Thanks to Tim Haines and John Griffiths for highlighting this issue!
  • ASIHTTPRequest progress + delegation tests are now more reliable. ASINetworkQueue tests that use delegates / progress delegates are still unreliable, hopefully I’ll think of a solution at some point.
  • Added some basic tests for measuring download performance against NSURLConnection.

v1.2 2nd November 2009

  • Fix several crashers relating to cancelling requests and requests that redirect. Many thanks to Jane Sales for her bug reports!
  • Requests can now generate a basic authentication header from a supplied username and password, and apply it to the request before it is sent (when shouldPresentCredentialsBeforeChallenge is YES). This should prevent round trips for requests to servers that use basic authentication when credentials are not already cached in the session store. Thanks to Travis Wyatt and others to have highlighted the need for this in the past.
  • Requests now catch exceptions generated by the request thread, and set the error property of the request with the details. Thanks to Aleks Nesterow for highlighting the need for this!
  • Tracking accurate progress for a queue of ASIS3Requests is now possible. Thanks to mobilemelting for his bug report!
  • Requests with a body no longer reset their method to POST unless the current method is GET, DELETE or HEAD. Thanks to Sangwoo Im for highlighting this issue!
  • Requests now use local rather than instance variable auto release pools for better code clarity / safety. Thanks again to Aleks Nesterow for suggesting this change!
  • ASINetworkQueues now have an userInfo dictionary you can use to store anything you like. Thanks again to mobilemelting for this!
  • Added a workaround for a type conversion issue that could cause crashes on iPhone OS 2.2.1 when building with a base SDK of 3.0 or greater. Thanks to Darren Andes for finding this!
  • Fixed potential crashes with attempting to remove non-existent credentials from the keychain store (this should only have happened if you called removeCredentialsForHost: / removeCredentialsForProxy: manually)
  • iPhone OS 2.2.1 simulator builds are hopefully working again
  • ASINetworkQueues now clear their requests’ queue properties rather than their delegate properties when they queue is dealloced.
  • Fix a regression where requests could call both finished and failed delegate methods in some circumstances

v1.1.1 6th October 2009

Added [request startAsynchronous] method. This allows requests to run in the background without having to setup a queue (it uses a global NSOperationQueue behind the scenes). Read more about this in the updated documentation.

Documentation update - Added some information to explain the behaviour of ASINetworkQueue, some information on strategies you can use for handling success and failure for multiple requests, and various smaller tweaks.

v1.1 4th October 2009

Various changes to ASIFormDataRequest:

  • Requests now specify the charset in the mime headers
  • Requests now have a stringEncoding property that allows you to set a different NSStringEncoding to be used as the charset (default remains UTF-8)
  • url-encoded form posts should now correctly encode the data
  • Requests now use application/x-www-form-urlencoded as the default format, though they’ll use multipart/form-data automatically when sending binary data

Many thanks to Maarten Billemont and Alessandro Segala for their code, jorfermo for his feature request, and Kevin O’Neill for testing!

Major refactor of session credentials:

  • ASIHTTPRequest can now cache multiple sets of credentials / proxy credentials in the session cache when useSessionPersistence is true. This should help to cut down on round trips for apps that connect to multiple servers that require authentication at once
  • Security Fix: Requests now check that credentials stored in the session cache were originally supplied to the same server before presenting them (the realms must also match when applying credentials after the server has asked for them)
  • Added new shouldPresentCredentialsBeforeChallenge property, when set to NO it will not present any cached credentials from the session store unless the server asks for them. Default is YES, which means that large requests that require authentication won’t have to be sent twice when valid credentials exist in the session store. Credentials from the keychain are never presented to the server unless it asks for them, regardless of the value of this property
  • Fixed a session-credentials related crash (Thanks to Victor Jalencas for his report!)

Also:

  • Various tweaks and fixes to proxy code, credentials for authenticating proxies can now be auto-detected on Mac OS
  • Fixed a bug where requests could attempt to remove the temporary download file twice, and a related error with locks (Thanks to J Stoppenbach for his report!)
  • Hopefully fixed a crasher that seemed to limited to Snow Leopard (Many thanks to Gersham Meharg for his assistance tracking this down!)
  • Fix status message leaking (Thanks to Stefano Barbato for picking this up!)
  • Moved cancelLoad out of ASIHTTPRequest.h, since it shouldn’t really be called outside of the request itself. Tweak docs to provide info on how to cancel a request.
  • Tweaked conditional complilation rules for more reliability

v1.0.9 13th September 2009

Added support for application/x-www-form-urlencoded form posts in ASIFormDataRequest. It isn’t used by default for now, but hopefully should help those users running servers that can’t understand multipart/form-data.

Use [request setPostFormat:ASIURLEncodedPostFormat] to use it. If you are transmitting binary data with the setFile:forKey:/setData:forKey: methods, it will automatically switch back to the default ASIMultipartFormDataPostFormat.

It currently uses NSString’s stringByAddingPercentEscapesUsingEncoding to encode the data. Please let me know if you encounter problems, as I am uncertain how well that method matches the percent encoding format that application/x-www-form-urlencoded is supposed to use.

Also, lots of fixes and tweaks:

  • Fixed an issue where request bodies were being discarded when shouldStreamRequestBodyFromDisk was true and delegate authentication failed (Thanks to Marcus Ramberg and Zac Cohan for catching this issue!)
  • Fix an issue with delegate authentication when the wrong credentials were presented (Thanks again to Zac Cohan for his bug report!)
  • ASIHTTPRequest will no longer crash when attempting to inflate into a path whose parent folder does not exist (Thanks to Tim Shadel for highlighting this!)
  • ASIAuthenticationDialog no longer leaks labels (Thanks to Jarin Udom for this fix!)
  • ASIS3Requests now use date formatters with the en_US_POSIX locale to avoid problems (Thanks to Nathan de Vries for this fix!)
  • NTLM authentication works again (Thanks to Alvic Paje for his report!), an NTLM handshake test is now enabled by default.
  • Added new responseStatusMessage property, which can be used to get the HTTP status message, eg: ‘HTTP/1.0 404 Not Found’ (Thanks to Mihail Merkulov for the request!)
  • Auto-generated user-agent strings now use CFBundleShortVersionString when it is available for version information (Thanks to Justin Mecham for this change!)
  • Stop using deprecated APIs, fix warnings in Mac sample XIBs and improve error handling for file system stuff: ASIHTTPRequest should now build without warnings on Snow Leopard

v1.0.8 24th August 2009

Added new ASIAuthenticationDialog class. This dialog can be used to ask the user for credentials when connecting to an authenticating webserver or proxy. Currently, this is only available in iPhone apps, support for Mac OS is coming soon.

By default, ASIHTTPRequest will show the authentication dialog for authenticating proxies when the request’s delegate doesn’t respond to proxyAuthenticationNeededForRequest. This means that apps using ASIHTTPRequest can now work with authenticating proxies transparently - you don’t need to do anything in your code.

Read more about the new dialog here.

Made major changes to delegate authentication. If you are using the delegation pattern to provide credentials, you will need to update your code to match the new API.

  • authorizationNeededForRequest: is now authenticationNeededForRequest:
  • proxyAuthorizationNeededForRequest: is now proxyAuthenticationNeededForRequest:
  • retryWithAuthentication is now retryUsingSuppliedCredentials
  • Delegates *MUST* now call cancelAuthentication to cancel an authentication challenge, NOT cancelLoad or cancel.

See the expanded documentation on standard and proxy authentication for more info.

Also:

  • Fixed a potential crash which could occur when cancelling requests. Thanks to Suraj Shah and uprise78 for reporting this!
  • Fixed 2.2.1 build. Thanks to rijks for his report!
  • Fixed a duplicate synthesized property, thanks to Justin Mecham and Bill Brown for catching this!
  • authenticationScheme and proxyAuthenticationScheme (formerly authenticationMethod and proxyAuthenticationMethod) are now publicly accessible properties
  • Expanded documentation with info about the new authentication dialog, changes to delegate authentication, and details on showAccurateProgress

v1.0.7 11th August 2009

  • Added experimental support for throttling bandwidth use. Thanks to Tom Beckerman for his feature request!
  • Added a lock to wrap access to sessionCookies, which might have caused crashes
  • Cleaned up ASIFormDataRequest, added the ability to set custom filenames and content-types for data (Thanks to Roman Busyghin for his patch!)
  • Updated docs with info about recent changes - redirection behaviour, proxies and throttling
  • iPhone apps now need to link with the SystemConfiguration framework

v1.0.6 2nd August 2009

Improved support for proxy servers:

  • Proxy auto-detection should now find the best proxy for the particular url you are requesting
  • ASIHTTPRequest can now find out about proxies from PAC files. This works when you have specified a PAC file in your network settings, or when you use setPACurl.
  • ASIHTTPRequest now supports proxies that require authentication. Set proxyUsername / proxyPassword manually, or have your delegate respond to proxyAuthorizationNeededForRequest:
  • You can now set proxies manually using proxyHost / proxyPort

Please let me know if you find problems with the new proxy functionality, it hasn’t been widely tested. I have no idea if it works with NTLM proxies or not, but I think theoretically it should do...

Also:

  • Fixed a bug that could cause erroneous timeouts when not using a downloadProgressDelegate. Thanks to Martin Destagnol for his assistance in tracking down this issue!
  • iPhone demo app now includes the authentication example from the Mac demo app
  • Cleanups to delegate authentication code

v1.0.5 26rd July 2009

  • Fixed a potential crasher where requests might attempt to access the readstream after it had been released
  • ASIHTTPRequest now generates a nice user agent for you if you don’t set one yourself, assuming you’ve set a CFBundleDisplayName or CFBundleName. Thanks to Andy Fowler for the code!
  • url is now a publicly settable property to get around problems with subclasses. Thanks to Charley Lanusse for his bug report!
  • Updated GHUnit, Tests now build on the device
  • Fix tests so they pass on the device (attempting to write outside the sandbox, doh!)
  • Progress delegate-related tests should be more reliable

v1.0.4 23rd July 2009

  • requestCookies is now emptied before a redirect. Any cookies in the persistent store (including session cookies) will be re-applied. This will ensure cookies are not present in the redirected request more than once, and that they won’t be presented to the wrong domain (if we redirect to a different domain).
  • Fixed a memory leak that crept in with the new redirection code

Thanks again to Austin France for taking the time to track these down!

  • ASINetworkQueue’s requestsCount property is now public-readable

v1.0.3 19th July 2009

  • All convenience constructors (eg [ASINetworkQueue queue]) now return instances of the class they were called on, so you can now safely use these in your subclasses
  • ASINetworkQueue now shows the network activity indicator (in the status bar) on the iPhone platform when network operations are in progress
  • ASINetworkQueues now use accessors throughout to make subclassing less painful

Many thanks to Ken Collins for his patch and pointing me at his subclass!

18th July 2009

  • Added gzip compression for request bodies (More info)
  • Various tweaks and cleanups

v1.0.2 16th July 2009

Fixed a nasty bug where requests would call both their didFinishSelector and didFailSelector under certain circumstances. I’ve added checks that should ensure this never happens.

Many thanks to Mike DeSaro for reporting this issue!

v1.0.1 15th July 2009

  • ASIHTTPRequest will now redirect as a GET request when it encounters a 303 HTTP status code, regardless of the original request method, as per RFC2616. Many thanks to Rick Moynihan for pointing out this problem!
  • S3: Added object copy support

v1.0 14th July 2009

  • Added experimental support for Amazon S3 (More info here)
  • Automatic redirection for 30x status codes is now handled by ASIHTTPRequest rather than CFNetwork. This means that the redirected request will use cookies set by the initial request. This might well be useful if you use session-based authentication and want to authenticate in your very first request. Many thanks to Austin France for highlighting this issue!

v0.995 25th June 2009

ASIHTTPRequest should now auto-detect system proxy settings, and apply those to requests. Mac apps using ASIHTTPRequest will now need to link against the SystemConfiguration framework, this is not necessary for iPhone apps.

This hasn’t had a lot of testing (I used Privoxy as a test server), so please let me know if you experience problems.

Thanks to everyone who requested this, most recently Malcolm Hall, Bill Tschumy and John Ngo.

v0.994 21st June 2009

Removed NSHTTPCookieAdditions, replaced with ASINSStringAdditions.

Cookies values are no longer automatically encoded and decoded because NSHTTPCookie won’t let you create cookies containing certain characters (eg line breaks), which would cause an exception while building responseCookies when a (valid, url-encoded) line break was present in the value.

Cookies values stored in the shared NSHTTPCookieStorage store are now stored with their values encoded.

If you want to create cookies manually in your own apps, you should encode the string you are using as the value with [myValue encodedCookieValue].

If you need to read the value of a cookie, you can use [[cookie value] decodedCookieValue] to get a url-decoded representation of the cookie value.

This change means that cookies stored in the shared cookie storage with previous versions of ASIHTTPRequest will be presented to the server un-encoded, which might cause problems.

Including ASINSStringAdditions.h and ASINSStringAdditions.m in your own programs is optional - if you don’t want to read url-decoded cookie values, or to build you own cookies, you don’t need them.

This release also includes various fixes:

  • Setting an empty string for a form post value with an ASIFormDataRequest should work now (Thanks to Jacky for finding this!)
  • Fixed some problems with SSL error detection on the iPhone platform (Thanks to Jane Sales for catching this!)
  • Tweaked the sample code the documentation to remove the autoreleased NSOperationQueue, because an autoreleased queue might be unsafe (Thanks to Scotch Vail for pointing this out!)
  • Update docs to point out the iPhone 3.0 SDK makes upload progress tracking work better (Thanks, Apple!)

v0.99 7th June 2009

Added validatesSecureCertificate property. Set this to no to skip the validation of secure certificates, for example when using self-signed certificates during testing. DO NOT USE IN PRODUCTION. :)

Thanks to everyone who requested this, most recently Aaron Attar and Gary Fung.

v0.98 31st May 2009

  • ASIHTTPRequest should now redirect automatically when it encounters a 30x header. You can disable this by setting shouldRedirect to NO. (Thanks to Michele Campeotto for this suggestion!)
  • Added convenience constructors:
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
    ASINetworkQueue *queue = [ASINetworkQueue queue];
    All return a new, auto-released instance, as you might expect.
  • Added Foundation.h imports to headers to allow ASIHTTPRequest to be built as part of a static library (Thanks to Steven Osborn for this!)
  • Added useHTTPVersionOne property to force the use of HTTP 1.0 instead of 1.1 (Thanks to Basil Shkara!)
  • NetworkRequestErrorDomain is now exported so you can compare it against the domain of errors generated by ASIHTTPRequest (Thanks to Roger Nolan for this!)
  • Code cleanup - many properties are now declared inside ASIHTTPRequest.m to keep them private. If I have made something private that you were previously relying on, please let me know!
  • Renamed outputStream to fileDownloadOutputStream for clarity

v0.97 16th May 2009

ASINetworkQueues no longer hijack the delegates of requests you add to them.

This means:

  • Delegates you set on requests will have their requestDidFinishSelectors and requestDidFailSelectors called when they are run from a queue.
  • You can now set downloadProgressDelegates and uploadProgressDelegates on requests you add to a queue, and these will be called when progress changes. The download progress queue example in the Mac sample application has been updated to demonstrate this: You can now have a progress indicator per request *and* an overall progress indicator for the queue.

See also the updated documentation on progress tracking.

Thanks to Serge Huber for pointing out this issue on his blog, I have no idea why I didn’t implement it like this to begin with... :)

The marvelous GHUnit is now included with ASIHTTPRequest, so running the tests should be as easy as choosing the test target.

This release also has a couple of tweaks to the tests, and a fix to prevent the Content-length header from being added to requests without a body, which could cause issues with some servers (eg lighty). Thanks once again to Roman Busyghin for contributing this patch.

Finally, I’ve updated the documentation to clarify a few things, including

  • Added a note about why you probably don’t want to use synchronous requests
  • Added a note about using NTLM authentication
  • Added a note about using delegation to provide authentication credentials
  • Tweaked the explanation of progress tracking, as noted above

v0.96 5th April 2009

Another big update:

  • ASIHTTPRequest can now stream the request body directly from disk. This should result in a big drop in memory use for large posts (which is especially great news for iPhone). More info here. Thanks to Neil Martin for his bug report!
  • Fixed some issues with multiple requests in an ASINetworkQueue when accurate progress was off
  • Added a couple of new tests
  • Fixed a couple of bugs in the tests
  • Some code restructuring, more comments
  • Fixed an issue with cookies being re-encoded each time they were added to the headers. Thanks to Richard Caetano for reporting this problem!
  • Fix two memory leaks, my thanks to Max Horváth for finding them, and also thanks to Max for suggesting the new Lighthouse issue tracker!

v0.951 22nd March 2009

  • Giant file layout cleanup. I’ve split the Mac and iPhone targets into two XCode projects, which should mean a) it ought to work with the new SDK, and b) I should stop running into all those quirky bugs XCode has when changing to a target with a different SDK.
  • Requests and ASINetworkQueues now include the amount of data already downloaded in progress display when resuming a file download. Also, a you can now call [request removeTemporaryDownloadFile] to remove partial downloads. This is only necessary if a request does not complete successfully. (If you didn’t specify your own custom temporaryFileDownloadPath, ASIHTTPRequest stores this file in a temporary folder anyway, so it will probably be cleaned up in the fullness of time.) Thanks to Matt Coneybeare for these requests.
  • Added userInfo NSDictionary to ASIHTTPRequest. You can this to store context-specific data that’s related to a particular request without subclassing, much like many of the Apple-supplied classes. Thanks to Roman Busyghin for this patch.

v0.94 16th March 2009

ASIHTTPRequest now supports resuming cancelled or interrupted file downloads. More information here.

Thanks to Matt Coneybeare for this feature request!

v0.93 12th March 2009

  • NTLM authentication should now be possible. I’ve made various structural changes to the authentication retry process to make this work. An NTLM test is also included, but you’ll need to add your own server details if you want to run this test. I’m very grateful to Justim Odendaal for providing me with access to a test server to get this working.
  • Fixed a small issue with the testRequestMethod test, and a nasty crasher that was triggered if you tried to upload to an invalid host when tracking upload progress. Many thanks to Michael Krause for contributing these fixes and the associated test!
  • handleBytesAvailable now uses a larger buffer size when the Content-Length header is set and the size of the body is larger than 64KB, hopefully this should improve download performance. Thanks to Matt Coneybeare for highlighting this!
  • Fixed a leak with setting responseHeaders

v0.92 27th February 2009

Unit tests now use the wonderful GHUnit instead of SenTestingKit. GHUnit provides a neat user interface, it makes debugging tests easy, and you can build iPhone unit tests! I’ve removed the old Tests target from the xcode project, and added in two new targets: Tests (GHUnit) and iPhone Tests (GHUnit).

If you want to run the tests, follow the instructions on this page.

Additionally, a bug fix for parsing the charset from the Content-Type header is included. Many thanks for the patch contributed by Roman Busyghin!

Finally, I have removed the erroneous statements in the documentation that falsely suggested downloading to a file is not supported on iPhone. Thanks to Serge Kolokolkin for pointing out the error of my ways! :)

v0.9 23rd February 2009

Added gzip support for response data. When allowCompressedResponse is true (it is by default), ASIHTTPRequest will add a header to notify the server that it will accept a compressed response. This change should help speed up requests when the response can be compressed. More information on gzip support is available here.

Other miscellaneous changes:

  • It is now necessary to link against zlib to use ASIHTTPRequest. I have added a new page to the documentation that explains how to link against zlib and CFNetwork
  • The dataString method has been renamed to responseString
  • File downloads now save their data to a temporary file whose path is stored in temporaryFileDownloadPath. When the download completes, the contents of the downloaded file will be decompressed to downloadDestinationPath when the response is gzipped, the temporary file will be moved to downloadDestinationPath when the response is not compressed.
  • When not downloading to a file, response data is now stored in rawResponseData. If the data is compressed, calls to responseData will return uncompressed data, or rawResponseData otherwise
  • You can call isResponseCompressed to find out if the response was compressed or not
  • Added a note about the limitations of upload progress tracking to the documentation

Thanks once again to Shaun Harrison of Enormego for contributing the gzip code!

v0.89 9th January 2009

ASIHTTPRequest now parses the text encoding from the Content-Type header when supplied. See the how to use section for information on how ASIHTTPRequest handles text encodings.

Many thanks to Shaun Harrison for this suggestion!

v0.881 5th January 2009

  • ASIFormDataRequest: setPostValue:forKey now takes any object that conforms to the NSObject protocol
  • ASIHTTPRequest subclasses no longer recreate statics when initalize is called, which would cause them to leak once for every subclass

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.