Ok, now things are getting exciting!
Merge branch 'new-queue-threading-model' into v1.7 Conflicts: Classes/ASIHTTPRequest.h Classes/ASIHTTPRequest.m
Showing
4 changed files
with
17 additions
and
9 deletions
| @@ -343,9 +343,6 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -343,9 +343,6 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 343 | // Default is YES | 343 | // Default is YES |
| 344 | BOOL shouldPresentCredentialsBeforeChallenge; | 344 | BOOL shouldPresentCredentialsBeforeChallenge; |
| 345 | 345 | ||
| 346 | - // YES when the request is run with runSynchronous, NO otherwise. READ-ONLY | ||
| 347 | - BOOL isSynchronous; | ||
| 348 | - | ||
| 349 | // YES when the request hasn't finished yet. Will still be YES even if the request isn't doing anything (eg it's waiting for delegate authentication). READ-ONLY | 346 | // YES when the request hasn't finished yet. Will still be YES even if the request isn't doing anything (eg it's waiting for delegate authentication). READ-ONLY |
| 350 | BOOL inProgress; | 347 | BOOL inProgress; |
| 351 | 348 | ||
| @@ -384,9 +381,6 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -384,9 +381,6 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 384 | // The stream will be closed + released either when another request comes to use the connection, or when the timer fires to tell the connection to expire | 381 | // The stream will be closed + released either when another request comes to use the connection, or when the timer fires to tell the connection to expire |
| 385 | NSMutableDictionary *connectionInfo; | 382 | NSMutableDictionary *connectionInfo; |
| 386 | 383 | ||
| 387 | - // This timer checks up on the request every 0.25 seconds, and updates progress | ||
| 388 | - NSTimer *statusTimer; | ||
| 389 | - | ||
| 390 | // When set to YES, 301 and 302 automatic redirects will use the original method and and body, according to the HTTP 1.1 standard | 384 | // When set to YES, 301 and 302 automatic redirects will use the original method and and body, according to the HTTP 1.1 standard |
| 391 | // Default is NO (to follow the behaviour of most browsers) | 385 | // Default is NO (to follow the behaviour of most browsers) |
| 392 | BOOL shouldUseRFC2616RedirectBehaviour; | 386 | BOOL shouldUseRFC2616RedirectBehaviour; |
| @@ -400,6 +394,10 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -400,6 +394,10 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 400 | // Will be ASIHTTPRequestRunLoopMode for synchronous requests, NSDefaultRunLoopMode for all other requests | 394 | // Will be ASIHTTPRequestRunLoopMode for synchronous requests, NSDefaultRunLoopMode for all other requests |
| 401 | NSString *runLoopMode; | 395 | NSString *runLoopMode; |
| 402 | 396 | ||
| 397 | + // This timer checks up on the request every 0.25 seconds, and updates progress | ||
| 398 | + NSTimer *statusTimer; | ||
| 399 | + | ||
| 400 | + | ||
| 403 | // The download cache that will be used for this request (use [ASIHTTPRequest setDefaultCache:cache] to configure a default cache | 401 | // The download cache that will be used for this request (use [ASIHTTPRequest setDefaultCache:cache] to configure a default cache |
| 404 | id <ASICacheDelegate> downloadCache; | 402 | id <ASICacheDelegate> downloadCache; |
| 405 | 403 | ||
| @@ -414,7 +412,6 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -414,7 +412,6 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 414 | 412 | ||
| 415 | // Set secondsToCache to use a custom time interval for expiring the response when it is stored in a cache | 413 | // Set secondsToCache to use a custom time interval for expiring the response when it is stored in a cache |
| 416 | NSTimeInterval secondsToCache; | 414 | NSTimeInterval secondsToCache; |
| 417 | - | ||
| 418 | } | 415 | } |
| 419 | 416 | ||
| 420 | #pragma mark init / dealloc | 417 | #pragma mark init / dealloc |
| @@ -717,6 +714,18 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -717,6 +714,18 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 717 | // Returns a date from a string in RFC1123 format | 714 | // Returns a date from a string in RFC1123 format |
| 718 | + (NSDate *)dateFromRFC1123String:(NSString *)string; | 715 | + (NSDate *)dateFromRFC1123String:(NSString *)string; |
| 719 | 716 | ||
| 717 | +#pragma mark threading behaviour | ||
| 718 | + | ||
| 719 | +// In the default implementation, all requests run in a single background thread | ||
| 720 | +// Advanced users only: Override this method in a subclass for a different threading behaviour | ||
| 721 | +// Eg: return [NSThread mainThread] to run all requests in the main thread | ||
| 722 | +// Alternatively, you can create a thread on demand, or manage a pool of threads | ||
| 723 | +// Threads returned by this method will need to run the runloop in default mode (eg CFRunLoopRun()) | ||
| 724 | +// Requests will stop the runloop when they complete | ||
| 725 | +// If you have multiple requests sharing the thread you'll need to restart the runloop when this happens | ||
| 726 | ++ (NSThread *)threadForRequest:(ASIHTTPRequest *)request; | ||
| 727 | + | ||
| 728 | + | ||
| 720 | #pragma mark === | 729 | #pragma mark === |
| 721 | 730 | ||
| 722 | @property (retain) NSString *username; | 731 | @property (retain) NSString *username; |
| @@ -794,7 +803,6 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | @@ -794,7 +803,6 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; | ||
| 794 | @property (assign, readonly) int proxyAuthenticationRetryCount; | 803 | @property (assign, readonly) int proxyAuthenticationRetryCount; |
| 795 | @property (assign) BOOL haveBuiltRequestHeaders; | 804 | @property (assign) BOOL haveBuiltRequestHeaders; |
| 796 | @property (assign, nonatomic) BOOL haveBuiltPostBody; | 805 | @property (assign, nonatomic) BOOL haveBuiltPostBody; |
| 797 | -@property (assign, readonly) BOOL isSynchronous; | ||
| 798 | @property (assign, readonly) BOOL inProgress; | 806 | @property (assign, readonly) BOOL inProgress; |
| 799 | @property (assign) int numberOfTimesToRetryOnTimeout; | 807 | @property (assign) int numberOfTimesToRetryOnTimeout; |
| 800 | @property (assign, readonly) int retryCount; | 808 | @property (assign, readonly) int retryCount; |
This diff is collapsed. Click to expand it.
| @@ -96,7 +96,7 @@ | @@ -96,7 +96,7 @@ | ||
| 96 | // Stop any other requests | 96 | // Stop any other requests |
| 97 | [networkQueue reset]; | 97 | [networkQueue reset]; |
| 98 | 98 | ||
| 99 | - [self setBigFetchRequest:[[[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/redirect_resume"]] autorelease]]; | 99 | + [self setBigFetchRequest:[ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/redirect_resume"]]]; |
| 100 | [[self bigFetchRequest] setDownloadDestinationPath:[[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"The Great American Novel.txt"]]; | 100 | [[self bigFetchRequest] setDownloadDestinationPath:[[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"The Great American Novel.txt"]]; |
| 101 | [[self bigFetchRequest] setTemporaryFileDownloadPath:[[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"The Great American Novel.txt.download"]]; | 101 | [[self bigFetchRequest] setTemporaryFileDownloadPath:[[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"The Great American Novel.txt.download"]]; |
| 102 | [[self bigFetchRequest] setAllowResumeForFileDownloads:YES]; | 102 | [[self bigFetchRequest] setAllowResumeForFileDownloads:YES]; |
This diff was suppressed by a .gitattributes entry.
-
Please register or login to post a comment