Commit graph

102 commits

Author SHA1 Message Date
Charles T. Ahn
c0bdc5db95 Try-catch in Objective-C should not be used to recover from exceptions
http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/Exceptions/Articles/ExceptionsAndCocoaFrameworks.html#//apple_ref/doc/uid/TP40009045-SW1

Relevant Quote:
  "The Cocoa frameworks are generally not exception-safe. The general
  pattern is that exceptions are reserved for programmer error only, and
  the program catching such an exception should quit soon afterwards."

More discussion here:
http://stackoverflow.com/questions/324284/how-to-throw-an-exception-in-objective-c-cocoa

Given all this, prefer a crash on the background thread.
2012-04-19 13:17:56 -07:00
Mattt Thompson
da1acf5a56 Merge branch 'master' into experimental-pause-resume
Conflicts:
	AFNetworking/AFHTTPRequestOperation.h
	AFNetworking/AFURLConnectionOperation.h
2012-04-08 15:28:58 -07:00
Mattt Thompson
407374746c Removing unnecessary ivar declaration in headers 2012-04-08 15:25:20 -07:00
Mattt Thompson
2a1d81a792 Cleaning up experimental bits
Re-creating AFDownloadRequestOperation, now with an API closer to NSURLDownload
2012-03-27 12:05:00 -07:00
Mattt Thompson
ca697ce300 Settling on a relatively stable implementation of pause/resume 2012-03-27 11:01:20 -07:00
Mattt Thompson
331d7bcbf2 Moving resumeable streaming download functionality to AFHTTPRequestOperation 2012-03-25 12:23:40 -07:00
Mattt Thompson
7bd7ee609b Replacing NSMutableData accumulator with NSOutputStream 2012-03-25 11:47:51 -07:00
Mattt Thompson
f2ae5c40ba Stashing re-implementation of resumeable streaming downloads into AFURLConnectionOperation 2012-03-25 11:14:17 -07:00
Peter Steinberger
2b2558a90e fixes an integer overflow for files > 2GB 2012-03-25 01:50:02 -07:00
Mattt Thompson
e61275110b Adding locking to AFURLConnectionOperation -setInputStream: 2012-03-20 11:33:15 -07:00
Mattt Thompson
2ec0c3ec2f Adding AFURLConnectionOperation -setShouldExecuteAsBackgroundTaskWithExpirationHandler: 2012-03-20 11:31:18 -07:00
Mattt Thompson
35a7b29286 [Issue #246] Making AFURLConnectionOperation behavior consistent for _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_ in -connection:didReceiveAuthenticationChallenge: 2012-03-13 09:02:42 -07:00
Mattt Thompson
ce2063f06d [Issue #236] Adding AFURLConnectionOperation -setCacheResponseBlock:, which allows the behavior of the NSURLConnectionDelegate method -connection:willCacheResponse: to be overridden without subclassing 2012-03-09 13:50:46 -08:00
Mattt Thompson
f489189a76 Fixing indentation of #225 2012-03-01 08:59:38 -08:00
Mattt Thompson
09401f9b66 Merge branch 'patch-1' of https://github.com/samsoffes/AFNetworking into samsoffes-patch-1 2012-03-01 08:56:42 -08:00
Kevin Harwood
a3bd0cc93e Releasing the connection in dealloc 2012-03-01 08:32:56 -06:00
Sam Soffes
34c6dc504b Avoid crash with nil URL in request 2012-02-29 14:35:45 -08:00
Kevin Harwood
229cb926ed Removed nil'ing connection from the cancel process. 2012-02-29 12:02:25 -06:00
Kevin Harwood
1bab351997 Moved nil'ing the connection until after the delegate is called 2012-02-29 11:57:54 -06:00
Kevin Harwood
68e13764af Added in cancel changes based on @zdzisiekpu's recommendation
Changed connection to be retained, and set the connection to be nil in
the cancel, success, and error case.
2012-02-29 11:43:47 -06:00
Mattt Thompson
51e17984b5 Removing excess whitespace 2012-02-29 08:47:05 -08:00
Erik Olsson
ec8daf2c02 Set cancelled on main thread to avoid crashes when canceling the same connection before it has had time to cancel. 2012-02-29 14:00:23 +01:00
Mattt Thompson
e0831197d3 Minor formatting changes
Adding line comment about why cancelConnection is being called as it is

Minor edit to comment about manually sending delegate message on cancel
2012-02-24 09:01:00 -08:00
Erik Olsson
f0ce3a86e3 Proposed fix to the race condition that occurs when stressing AFURLConnectionOperation.
Cancels the NSURLConnection on the same thread as the one where it was created.
2012-02-23 18:05:27 +01:00
Mattt Thompson
7f413b3c38 Fixing property setters for authentication block properties 2012-02-14 09:13:03 -08:00
Mattt Thompson
17f55849d9 [Issue 204] Adding authenticationAgainstProtectionSpace block, to intercept connection:canAuthenticateAgainstProtectionSpace: (Thanks Kevin Harwood & Peter Steinberger)
Adding #ifdef _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_ macros for NSURLConnection authentication delegate methods
2012-02-14 08:38:49 -08:00
Mattt Thompson
21e907cb98 Adding -description to AFURLConnectionOperation 2012-01-23 08:35:43 -08:00
Mattt Thompson
df21de7e63 Merge branch 'experimental-thread-safe' into experimental-0.9
Conflicts:
	AFNetworking/AFURLConnectionOperation.m
2012-01-19 16:55:00 -08:00
Charlie Williams
8688e7e505 Explicit cast in line 378 to uint8_t* needed for some build configs (i.e. mine) to avoid error. 2012-01-18 15:27:30 -08:00
Jorge Bernal
728f5c3d75 Cancel request if there is an authentication challenge but no credentials for it
Conflicts:

	AFNetworking/AFURLConnectionOperation.m
2012-01-10 14:40:15 -08:00
Mattt Thompson
bdab46889b Use nested if/else instead of early return in -connection:didReceiveAuthenticationChallenge: 2012-01-10 13:41:36 -08:00
Mattt Thompson
68c572ae32 Refactoring -cancel and -isCancelled 2011-12-08 13:21:23 -06:00
Mattt Thompson
a466c27886 Adding @try/@catch with autorelease pool for exceptions
Wrapping -start in lock
2011-12-08 12:42:59 -06:00
Mattt Thompson
680fcd5071 First iteration of thread-safety on AFURLConnectionOperation, using a combination of NSRecursiveLock and common sense 2011-12-08 12:23:58 -06:00
Mattt Thompson
8869bb9ad3 Adding authentication challenge callback block to override default NSURLConnection delegate method implementation 2011-12-04 03:45:02 -06:00
Mattt Thompson
e18c305034 Default implementation for connection:didReceiveAuthenticationChallenge: delegate method 2011-12-04 03:35:21 -06:00
Mattt Thompson
e37c641656 [Issue #124] Calling super implementation in -isReady, following the guidelines for NSOperation subclasses 2011-11-22 21:22:13 -06:00
Mattt Thompson
a912382431 Changing connection property from retain to assign, to avoid retain cycle caused by NSURLConnection retaining its delegate 2011-11-22 20:57:39 -06:00
Mattt Thompson
4a93904566 Set text encoding for -responseString to UTF-8 by default, in case an encoding is not set in the response 2011-10-13 12:57:39 -05:00
Mattt Thompson
840eca217c Documentation for AFURLConnectionOperation 2011-10-11 15:27:36 -05:00
Mattt Thompson
b626edf490 Removing dispatch to main queue to set completion block, since that causes deadlock in (at least) iOS 5 and Mac OS 10.7 2011-10-11 12:26:21 -05:00
Mattt Thompson
d2be778f9c Adding missing early return in setCompletionBlock: 2011-10-11 10:52:16 -05:00
Mattt Thompson
95bcd2278c Only execute in main queue 2011-10-10 13:26:17 -05:00
Mattt Thompson
f1fa6f1a6f [Issue #56] Wrapping completion block in async_dispatch to main queue 2011-10-10 13:18:41 -05:00
Mattt Thompson
ce9872965c [Issue #56] Fixing 'The Dealloc Problem' 2011-10-10 13:05:22 -05:00
Mattt Thompson
9b1c1f285c Checking for cancellation early in -operationDidStart 2011-10-06 10:15:58 -05:00
Mattt Thompson
c2be31d4fa First implementation of protocol for AFHTTPClient to register classes to automatically determine the appropriate operation to create
Wrapping AFURLConnectionOperation -setCompletionBlock: with blockSelf release pattern to avoid retain cycle
2011-10-05 15:44:51 -05:00
Mattt Thompson
c2e5ca2726 Renaming _responseBody ivar to _responseData 2011-10-05 12:47:51 -05:00
Mattt Thompson
ccdc5f2d9b Approaching a reasonable design for restructuring AFHTTPRequestOperation and subclasses 2011-10-05 12:36:45 -05:00
Mattt Thompson
c0cba6748a Refactoring state transition logic for AFURLConnectionOperation 2011-10-05 11:26:51 -05:00