From b494bfe3fb5281a4a20085420e854189a12cd4bd Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Sat, 4 Aug 2012 15:48:01 -0400 Subject: [PATCH] Adding NSURLConnection delegate method declarations in the AFURLConnection header to allow subclasses to call out to super implementation. Will be removed in 1.0, since iOS 5 / Mac OS 10.7 defined these as a formal protocol. --- AFNetworking/AFURLConnectionOperation.h | 34 +++++++++++++++++++++++++ AFNetworking/AFURLConnectionOperation.m | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/AFNetworking/AFURLConnectionOperation.h b/AFNetworking/AFURLConnectionOperation.h index cc7d93f..1aca1d1 100644 --- a/AFNetworking/AFURLConnectionOperation.h +++ b/AFNetworking/AFURLConnectionOperation.h @@ -251,4 +251,38 @@ extern NSString * const AFNetworkingOperationDidFinishNotification; */ - (void)setCacheResponseBlock:(NSCachedURLResponse * (^)(NSURLConnection *connection, NSCachedURLResponse *cachedResponse))block; +///--------------------------------------- +/// @name NSURLConnection Delegate Methods +/// @discussion NSURLConnection delegate methods were part of an informal protocol until iOS 5 & Mac OS 10.7, so the method signatures are declared here in order to allow subclasses to override these methods and call back to the super implementation. +///--------------------------------------- + +- (BOOL)connection:(NSURLConnection *)connection +canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace; + +- (void)connection:(NSURLConnection *)connection +didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; + +- (NSURLRequest *)connection:(NSURLConnection *)connection + willSendRequest:(NSURLRequest *)request + redirectResponse:(NSURLResponse *)redirectResponse; + +- (void)connection:(NSURLConnection *)connection + didSendBodyData:(NSInteger)bytesWritten + totalBytesWritten:(NSInteger)totalBytesWritten +totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite; + +- (void)connection:(NSURLConnection *)connection +didReceiveResponse:(NSURLResponse *)response; + +- (void)connection:(NSURLConnection *)connection + didReceiveData:(NSData *)data; + +- (void)connectionDidFinishLoading:(NSURLConnection *)connection; + +- (void)connection:(NSURLConnection *)connection + didFailWithError:(NSError *)error; + +- (NSCachedURLResponse *)connection:(NSURLConnection *)connection + willCacheResponse:(NSCachedURLResponse *)cachedResponse; + @end diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index 7defb7f..9d5d95f 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -524,7 +524,7 @@ didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request - redirectResponse:(NSURLResponse *)redirectResponse; + redirectResponse:(NSURLResponse *)redirectResponse { if (self.redirectResponse) { return self.redirectResponse(connection, request, redirectResponse);