Ben Copsey

Merge branch 'master' into openresearch-fork

Conflicts:
	.gitignore
... ... @@ -7,4 +7,5 @@ build
*tmproj
.DS_Store
profile
*.pbxuser
*.mode1v3
... ...
... ... @@ -78,6 +78,7 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
// Another delegate that is also notified of request status changes and progress updates
// Generally, you won't use this directly, but ASINetworkQueue sets itself as the queue so it can proxy updates to its own delegates
// NOTE: WILL BE RETAINED BY THE REQUEST
id <ASIHTTPRequestDelegate, ASIProgressDelegate> queue;
// HTTP method to use (GET / POST / PUT / DELETE / HEAD). Defaults to GET
... ... @@ -153,6 +154,12 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
// When the request fails or completes successfully, complete will be true
BOOL complete;
// external "finished" indicator, subject of KVO notifications; updates after 'complete'
BOOL finished;
// True if our 'cancel' selector has been called
BOOL cancelled;
// If an error occurs, error will contain an NSError
// If error code is = ASIConnectionFailureErrorType (1, Connection failure occurred) - inspect [[error userInfo] objectForKey:NSUnderlyingErrorKey] for more information
NSError *error;
... ... @@ -709,6 +716,11 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
#endif
#pragma mark queue
// Returns the shared queue
+ (NSOperationQueue *)sharedQueue;
#pragma mark cache
+ (void)setDefaultCache:(id <ASICacheDelegate>)cache;
... ... @@ -720,9 +732,15 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
#pragma mark network activity
+ (BOOL)isNetworkInUse;
#if TARGET_OS_IPHONE
+ (void)setShouldUpdateNetworkActivityIndicator:(BOOL)shouldUpdate;
#endif
// Shows the network activity spinner thing on iOS. You may wish to override this to do something else in Mac projects
+ (void)showNetworkActivityIndicator;
// Hides the network activity spinner thing on iOS
+ (void)hideNetworkActivityIndicator;
#pragma mark miscellany
... ... @@ -762,7 +780,7 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
@property (retain,setter=setURL:) NSURL *url;
@property (retain) NSURL *originalURL;
@property (assign, nonatomic) id delegate;
@property (assign, nonatomic) id queue;
@property (retain, nonatomic) id queue;
@property (assign, nonatomic) id uploadProgressDelegate;
@property (assign, nonatomic) id downloadProgressDelegate;
@property (assign) BOOL useKeychainPersistence;
... ...
This diff is collapsed. Click to expand it.
... ... @@ -76,6 +76,7 @@
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/the_great_american_novel_%28abridged%29.txt"]];
[request startAsynchronous];
[request cancel];
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.0]];
GHAssertNotNil([request error],@"Failed to cancel the request");
// Test cancelling a redirected request works
... ... @@ -85,6 +86,7 @@
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.0]];
[request cancel];
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.0]];
BOOL success = ([[[request url] absoluteString] isEqualToString:@"http://allseeing-i.com/ASIHTTPRequest/tests/the_great_american_novel.txt"]);
... ...
... ... @@ -55,6 +55,11 @@ IMPORTANT
- (void)testDelegateMethods
{
[self performSelectorOnMainThread:@selector(runDelegateMethodsTest) withObject:nil waitUntilDone:YES];
}
- (void)runDelegateMethodsTest
{
started = NO;
finished = NO;
failed = NO;
... ... @@ -436,8 +441,6 @@ IMPORTANT
success = ([request5 responseStatusCode] == 404);
GHAssertTrue(success,@"Failed to obtain the correct status code for request 5");
[requestThatShouldFail release];
}
... ... @@ -616,10 +619,6 @@ IMPORTANT
}
}
- (void)requestFailedExpectedly:(ASIHTTPRequest *)request
{
request_didfail = YES;
... ... @@ -678,6 +677,7 @@ IMPORTANT
NSURL *downloadURL = [NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/the_great_american_novel_%28young_readers_edition%29.txt"];
ASINetworkQueue *networkQueue = [ASINetworkQueue queue];
[networkQueue setShouldCancelAllRequestsOnFailure:NO];
ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:downloadURL] autorelease];
[request setDownloadDestinationPath:downloadPath];
... ... @@ -1084,9 +1084,14 @@ IMPORTANT
GHAssertTrue(success,@"Failed to send credentials correctly? (Expected: '%@', got '%@')",expectedResponse,[[request responseString] lowercaseString]);
}
// Test for a bug where failing head requests would not notify the original request's delegate of the failure
- (void)testHEADFailure
{
[self performSelectorOnMainThread:@selector(runHEADFailureTest) withObject:nil waitUntilDone:YES];
}
// Test for a bug where failing head requests would not notify the original request's delegate of the failure
- (void)runHEADFailureTest
{
headFailed = NO;
ASINetworkQueue *queue = [ASINetworkQueue queue];
[queue setShowAccurateProgress:YES];
... ...
... ... @@ -2,15 +2,18 @@ ASIHTTPRequest donors:
Stephan Burlot (http://www.coriolis.ch)
Jack Cardinal (http://www.intomotion.com)
Wonki Chung
Matt Coneybeare (http://urbanapps.com)
Connected Bits LLC (http://www.connectedbits.com)
Nathan de Vries (http://www.atnan.com)
Hunter Hillegas
Felix Holmgren
Jaanus Kase
Thomas Kiesl (http://kiesl.eu)
John Paul May (http://smhk.com)
Jirapong Nanta (http://bananacoding.com)
Francesco Segala (http://youarchive.it)
Alessandro Segala (http://letsdev.it)
Dan Zeitman
Many thanks!
... ...
... ... @@ -12,6 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="60"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
... ... @@ -107,7 +108,7 @@
</object>
<object class="IBUIViewController" key="IBUIDetailViewController" id="383891141">
<reference key="IBUIParentViewController" ref="619662148"/>
<string key="IBUINibName">Synchronous</string>
<string key="IBUINibName">Sample</string>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
<int key="IBUIStatusBarStyle">2</int>
</object>
... ... @@ -279,14 +280,14 @@
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<string>{{374, 13}, {768, 1024}}</string>
<string>{{682, 13}, {768, 1024}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<integer value="1"/>
<string>iPadSampleAppDelegate</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>SynchronousViewController</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>{{329, 308}, {1024, 768}}</string>
<string>{{571, 157}, {1024, 768}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>RootViewController</string>
... ... @@ -339,7 +340,7 @@
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">RootViewController.h</string>
<string key="minorKey">iPhone Sample/RootViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
... ... @@ -379,7 +380,7 @@
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">SampleViewController.h</string>
<string key="minorKey">iPhone Sample/SampleViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
... ... @@ -438,7 +439,7 @@
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">iPadSampleAppDelegate.h</string>
<string key="minorKey">iPhone Sample/iPadSampleAppDelegate.h</string>
</object>
</object>
</object>
... ...