Merge branch 'master' into openresearch-fork
Conflicts: .gitignore
Showing
7 changed files
with
49 additions
and
19 deletions
| @@ -78,6 +78,7 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -78,6 +78,7 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 78 | 78 | ||
| 79 | // Another delegate that is also notified of request status changes and progress updates | 79 | // Another delegate that is also notified of request status changes and progress updates |
| 80 | // Generally, you won't use this directly, but ASINetworkQueue sets itself as the queue so it can proxy updates to its own delegates | 80 | // Generally, you won't use this directly, but ASINetworkQueue sets itself as the queue so it can proxy updates to its own delegates |
| 81 | + // NOTE: WILL BE RETAINED BY THE REQUEST | ||
| 81 | id <ASIHTTPRequestDelegate, ASIProgressDelegate> queue; | 82 | id <ASIHTTPRequestDelegate, ASIProgressDelegate> queue; |
| 82 | 83 | ||
| 83 | // HTTP method to use (GET / POST / PUT / DELETE / HEAD). Defaults to GET | 84 | // HTTP method to use (GET / POST / PUT / DELETE / HEAD). Defaults to GET |
| @@ -153,6 +154,12 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -153,6 +154,12 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 153 | // When the request fails or completes successfully, complete will be true | 154 | // When the request fails or completes successfully, complete will be true |
| 154 | BOOL complete; | 155 | BOOL complete; |
| 155 | 156 | ||
| 157 | + // external "finished" indicator, subject of KVO notifications; updates after 'complete' | ||
| 158 | + BOOL finished; | ||
| 159 | + | ||
| 160 | + // True if our 'cancel' selector has been called | ||
| 161 | + BOOL cancelled; | ||
| 162 | + | ||
| 156 | // If an error occurs, error will contain an NSError | 163 | // If an error occurs, error will contain an NSError |
| 157 | // If error code is = ASIConnectionFailureErrorType (1, Connection failure occurred) - inspect [[error userInfo] objectForKey:NSUnderlyingErrorKey] for more information | 164 | // If error code is = ASIConnectionFailureErrorType (1, Connection failure occurred) - inspect [[error userInfo] objectForKey:NSUnderlyingErrorKey] for more information |
| 158 | NSError *error; | 165 | NSError *error; |
| @@ -709,6 +716,11 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -709,6 +716,11 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 709 | 716 | ||
| 710 | #endif | 717 | #endif |
| 711 | 718 | ||
| 719 | +#pragma mark queue | ||
| 720 | + | ||
| 721 | +// Returns the shared queue | ||
| 722 | ++ (NSOperationQueue *)sharedQueue; | ||
| 723 | + | ||
| 712 | #pragma mark cache | 724 | #pragma mark cache |
| 713 | 725 | ||
| 714 | + (void)setDefaultCache:(id <ASICacheDelegate>)cache; | 726 | + (void)setDefaultCache:(id <ASICacheDelegate>)cache; |
| @@ -720,9 +732,15 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -720,9 +732,15 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 720 | #pragma mark network activity | 732 | #pragma mark network activity |
| 721 | 733 | ||
| 722 | + (BOOL)isNetworkInUse; | 734 | + (BOOL)isNetworkInUse; |
| 723 | -#if TARGET_OS_IPHONE | 735 | + |
| 724 | + (void)setShouldUpdateNetworkActivityIndicator:(BOOL)shouldUpdate; | 736 | + (void)setShouldUpdateNetworkActivityIndicator:(BOOL)shouldUpdate; |
| 725 | -#endif | 737 | + |
| 738 | +// Shows the network activity spinner thing on iOS. You may wish to override this to do something else in Mac projects | ||
| 739 | ++ (void)showNetworkActivityIndicator; | ||
| 740 | + | ||
| 741 | +// Hides the network activity spinner thing on iOS | ||
| 742 | ++ (void)hideNetworkActivityIndicator; | ||
| 743 | + | ||
| 726 | 744 | ||
| 727 | #pragma mark miscellany | 745 | #pragma mark miscellany |
| 728 | 746 | ||
| @@ -762,7 +780,7 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -762,7 +780,7 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 762 | @property (retain,setter=setURL:) NSURL *url; | 780 | @property (retain,setter=setURL:) NSURL *url; |
| 763 | @property (retain) NSURL *originalURL; | 781 | @property (retain) NSURL *originalURL; |
| 764 | @property (assign, nonatomic) id delegate; | 782 | @property (assign, nonatomic) id delegate; |
| 765 | -@property (assign, nonatomic) id queue; | 783 | +@property (retain, nonatomic) id queue; |
| 766 | @property (assign, nonatomic) id uploadProgressDelegate; | 784 | @property (assign, nonatomic) id uploadProgressDelegate; |
| 767 | @property (assign, nonatomic) id downloadProgressDelegate; | 785 | @property (assign, nonatomic) id downloadProgressDelegate; |
| 768 | @property (assign) BOOL useKeychainPersistence; | 786 | @property (assign) BOOL useKeychainPersistence; |
This diff is collapsed. Click to expand it.
| @@ -76,6 +76,7 @@ | @@ -76,6 +76,7 @@ | ||
| 76 | ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/the_great_american_novel_%28abridged%29.txt"]]; | 76 | ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/the_great_american_novel_%28abridged%29.txt"]]; |
| 77 | [request startAsynchronous]; | 77 | [request startAsynchronous]; |
| 78 | [request cancel]; | 78 | [request cancel]; |
| 79 | + [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.0]]; | ||
| 79 | GHAssertNotNil([request error],@"Failed to cancel the request"); | 80 | GHAssertNotNil([request error],@"Failed to cancel the request"); |
| 80 | 81 | ||
| 81 | // Test cancelling a redirected request works | 82 | // Test cancelling a redirected request works |
| @@ -85,6 +86,7 @@ | @@ -85,6 +86,7 @@ | ||
| 85 | 86 | ||
| 86 | [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.0]]; | 87 | [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.0]]; |
| 87 | [request cancel]; | 88 | [request cancel]; |
| 89 | + [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.0]]; | ||
| 88 | 90 | ||
| 89 | BOOL success = ([[[request url] absoluteString] isEqualToString:@"http://allseeing-i.com/ASIHTTPRequest/tests/the_great_american_novel.txt"]); | 91 | BOOL success = ([[[request url] absoluteString] isEqualToString:@"http://allseeing-i.com/ASIHTTPRequest/tests/the_great_american_novel.txt"]); |
| 90 | 92 |
| @@ -55,6 +55,11 @@ IMPORTANT | @@ -55,6 +55,11 @@ IMPORTANT | ||
| 55 | 55 | ||
| 56 | - (void)testDelegateMethods | 56 | - (void)testDelegateMethods |
| 57 | { | 57 | { |
| 58 | + [self performSelectorOnMainThread:@selector(runDelegateMethodsTest) withObject:nil waitUntilDone:YES]; | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +- (void)runDelegateMethodsTest | ||
| 62 | +{ | ||
| 58 | started = NO; | 63 | started = NO; |
| 59 | finished = NO; | 64 | finished = NO; |
| 60 | failed = NO; | 65 | failed = NO; |
| @@ -436,8 +441,6 @@ IMPORTANT | @@ -436,8 +441,6 @@ IMPORTANT | ||
| 436 | success = ([request5 responseStatusCode] == 404); | 441 | success = ([request5 responseStatusCode] == 404); |
| 437 | GHAssertTrue(success,@"Failed to obtain the correct status code for request 5"); | 442 | GHAssertTrue(success,@"Failed to obtain the correct status code for request 5"); |
| 438 | 443 | ||
| 439 | - | ||
| 440 | - | ||
| 441 | [requestThatShouldFail release]; | 444 | [requestThatShouldFail release]; |
| 442 | 445 | ||
| 443 | } | 446 | } |
| @@ -616,10 +619,6 @@ IMPORTANT | @@ -616,10 +619,6 @@ IMPORTANT | ||
| 616 | } | 619 | } |
| 617 | } | 620 | } |
| 618 | 621 | ||
| 619 | - | ||
| 620 | - | ||
| 621 | - | ||
| 622 | - | ||
| 623 | - (void)requestFailedExpectedly:(ASIHTTPRequest *)request | 622 | - (void)requestFailedExpectedly:(ASIHTTPRequest *)request |
| 624 | { | 623 | { |
| 625 | request_didfail = YES; | 624 | request_didfail = YES; |
| @@ -677,7 +676,8 @@ IMPORTANT | @@ -677,7 +676,8 @@ IMPORTANT | ||
| 677 | } | 676 | } |
| 678 | 677 | ||
| 679 | NSURL *downloadURL = [NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/the_great_american_novel_%28young_readers_edition%29.txt"]; | 678 | NSURL *downloadURL = [NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/the_great_american_novel_%28young_readers_edition%29.txt"]; |
| 680 | - ASINetworkQueue *networkQueue = [ASINetworkQueue queue]; | 679 | + ASINetworkQueue *networkQueue = [ASINetworkQueue queue]; |
| 680 | + [networkQueue setShouldCancelAllRequestsOnFailure:NO]; | ||
| 681 | 681 | ||
| 682 | ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:downloadURL] autorelease]; | 682 | ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:downloadURL] autorelease]; |
| 683 | [request setDownloadDestinationPath:downloadPath]; | 683 | [request setDownloadDestinationPath:downloadPath]; |
| @@ -1084,9 +1084,14 @@ IMPORTANT | @@ -1084,9 +1084,14 @@ IMPORTANT | ||
| 1084 | GHAssertTrue(success,@"Failed to send credentials correctly? (Expected: '%@', got '%@')",expectedResponse,[[request responseString] lowercaseString]); | 1084 | GHAssertTrue(success,@"Failed to send credentials correctly? (Expected: '%@', got '%@')",expectedResponse,[[request responseString] lowercaseString]); |
| 1085 | } | 1085 | } |
| 1086 | 1086 | ||
| 1087 | -// Test for a bug where failing head requests would not notify the original request's delegate of the failure | ||
| 1088 | - (void)testHEADFailure | 1087 | - (void)testHEADFailure |
| 1089 | { | 1088 | { |
| 1089 | + [self performSelectorOnMainThread:@selector(runHEADFailureTest) withObject:nil waitUntilDone:YES]; | ||
| 1090 | +} | ||
| 1091 | + | ||
| 1092 | +// Test for a bug where failing head requests would not notify the original request's delegate of the failure | ||
| 1093 | +- (void)runHEADFailureTest | ||
| 1094 | +{ | ||
| 1090 | headFailed = NO; | 1095 | headFailed = NO; |
| 1091 | ASINetworkQueue *queue = [ASINetworkQueue queue]; | 1096 | ASINetworkQueue *queue = [ASINetworkQueue queue]; |
| 1092 | [queue setShowAccurateProgress:YES]; | 1097 | [queue setShowAccurateProgress:YES]; |
| @@ -2,15 +2,18 @@ ASIHTTPRequest donors: | @@ -2,15 +2,18 @@ ASIHTTPRequest donors: | ||
| 2 | 2 | ||
| 3 | Stephan Burlot (http://www.coriolis.ch) | 3 | Stephan Burlot (http://www.coriolis.ch) |
| 4 | Jack Cardinal (http://www.intomotion.com) | 4 | Jack Cardinal (http://www.intomotion.com) |
| 5 | +Wonki Chung | ||
| 5 | Matt Coneybeare (http://urbanapps.com) | 6 | Matt Coneybeare (http://urbanapps.com) |
| 6 | Connected Bits LLC (http://www.connectedbits.com) | 7 | Connected Bits LLC (http://www.connectedbits.com) |
| 7 | Nathan de Vries (http://www.atnan.com) | 8 | Nathan de Vries (http://www.atnan.com) |
| 8 | Hunter Hillegas | 9 | Hunter Hillegas |
| 10 | +Felix Holmgren | ||
| 9 | Jaanus Kase | 11 | Jaanus Kase |
| 10 | Thomas Kiesl (http://kiesl.eu) | 12 | Thomas Kiesl (http://kiesl.eu) |
| 11 | John Paul May (http://smhk.com) | 13 | John Paul May (http://smhk.com) |
| 12 | Jirapong Nanta (http://bananacoding.com) | 14 | Jirapong Nanta (http://bananacoding.com) |
| 13 | -Francesco Segala (http://youarchive.it) | 15 | +Alessandro Segala (http://letsdev.it) |
| 16 | +Dan Zeitman | ||
| 14 | 17 | ||
| 15 | Many thanks! | 18 | Many thanks! |
| 16 | 19 |
| @@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
| 12 | </object> | 12 | </object> |
| 13 | <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> | 13 | <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> |
| 14 | <bool key="EncodedWithXMLCoder">YES</bool> | 14 | <bool key="EncodedWithXMLCoder">YES</bool> |
| 15 | + <integer value="60"/> | ||
| 15 | </object> | 16 | </object> |
| 16 | <object class="NSArray" key="IBDocument.PluginDependencies"> | 17 | <object class="NSArray" key="IBDocument.PluginDependencies"> |
| 17 | <bool key="EncodedWithXMLCoder">YES</bool> | 18 | <bool key="EncodedWithXMLCoder">YES</bool> |
| @@ -107,7 +108,7 @@ | @@ -107,7 +108,7 @@ | ||
| 107 | </object> | 108 | </object> |
| 108 | <object class="IBUIViewController" key="IBUIDetailViewController" id="383891141"> | 109 | <object class="IBUIViewController" key="IBUIDetailViewController" id="383891141"> |
| 109 | <reference key="IBUIParentViewController" ref="619662148"/> | 110 | <reference key="IBUIParentViewController" ref="619662148"/> |
| 110 | - <string key="IBUINibName">Synchronous</string> | 111 | + <string key="IBUINibName">Sample</string> |
| 111 | <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"> | 112 | <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"> |
| 112 | <int key="IBUIStatusBarStyle">2</int> | 113 | <int key="IBUIStatusBarStyle">2</int> |
| 113 | </object> | 114 | </object> |
| @@ -279,14 +280,14 @@ | @@ -279,14 +280,14 @@ | ||
| 279 | <bool key="EncodedWithXMLCoder">YES</bool> | 280 | <bool key="EncodedWithXMLCoder">YES</bool> |
| 280 | </object> | 281 | </object> |
| 281 | </object> | 282 | </object> |
| 282 | - <string>{{374, 13}, {768, 1024}}</string> | 283 | + <string>{{682, 13}, {768, 1024}}</string> |
| 283 | <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> | 284 | <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
| 284 | <integer value="1"/> | 285 | <integer value="1"/> |
| 285 | <string>iPadSampleAppDelegate</string> | 286 | <string>iPadSampleAppDelegate</string> |
| 286 | <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> | 287 | <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
| 287 | <string>SynchronousViewController</string> | 288 | <string>SynchronousViewController</string> |
| 288 | <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> | 289 | <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
| 289 | - <string>{{329, 308}, {1024, 768}}</string> | 290 | + <string>{{571, 157}, {1024, 768}}</string> |
| 290 | <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> | 291 | <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
| 291 | <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> | 292 | <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
| 292 | <string>RootViewController</string> | 293 | <string>RootViewController</string> |
| @@ -339,7 +340,7 @@ | @@ -339,7 +340,7 @@ | ||
| 339 | </object> | 340 | </object> |
| 340 | <object class="IBClassDescriptionSource" key="sourceIdentifier"> | 341 | <object class="IBClassDescriptionSource" key="sourceIdentifier"> |
| 341 | <string key="majorKey">IBProjectSource</string> | 342 | <string key="majorKey">IBProjectSource</string> |
| 342 | - <string key="minorKey">RootViewController.h</string> | 343 | + <string key="minorKey">iPhone Sample/RootViewController.h</string> |
| 343 | </object> | 344 | </object> |
| 344 | </object> | 345 | </object> |
| 345 | <object class="IBPartialClassDescription"> | 346 | <object class="IBPartialClassDescription"> |
| @@ -379,7 +380,7 @@ | @@ -379,7 +380,7 @@ | ||
| 379 | </object> | 380 | </object> |
| 380 | <object class="IBClassDescriptionSource" key="sourceIdentifier"> | 381 | <object class="IBClassDescriptionSource" key="sourceIdentifier"> |
| 381 | <string key="majorKey">IBProjectSource</string> | 382 | <string key="majorKey">IBProjectSource</string> |
| 382 | - <string key="minorKey">SampleViewController.h</string> | 383 | + <string key="minorKey">iPhone Sample/SampleViewController.h</string> |
| 383 | </object> | 384 | </object> |
| 384 | </object> | 385 | </object> |
| 385 | <object class="IBPartialClassDescription"> | 386 | <object class="IBPartialClassDescription"> |
| @@ -438,7 +439,7 @@ | @@ -438,7 +439,7 @@ | ||
| 438 | </object> | 439 | </object> |
| 439 | <object class="IBClassDescriptionSource" key="sourceIdentifier"> | 440 | <object class="IBClassDescriptionSource" key="sourceIdentifier"> |
| 440 | <string key="majorKey">IBProjectSource</string> | 441 | <string key="majorKey">IBProjectSource</string> |
| 441 | - <string key="minorKey">iPadSampleAppDelegate.h</string> | 442 | + <string key="minorKey">iPhone Sample/iPadSampleAppDelegate.h</string> |
| 442 | </object> | 443 | </object> |
| 443 | </object> | 444 | </object> |
| 444 | </object> | 445 | </object> |
-
Please register or login to post a comment