mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-19 09:11:29 +08:00
Revert "Merge branch 'nolanw-request-delegate-gets-failed-auth-challenge'"
This reverts commitd6510d963f, reversing changes made toa1e2061106.
This commit is contained in:
@@ -469,9 +469,4 @@ typedef enum {
|
||||
*/
|
||||
- (void)requestDidTimeout:(RKRequest *)request;
|
||||
|
||||
/**
|
||||
* Sent when a request fails authentication
|
||||
*/
|
||||
- (void)request:(RKRequest *)request didFailAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
|
||||
|
||||
@end
|
||||
|
||||
@@ -51,7 +51,9 @@ extern NSString* cacheURLKey;
|
||||
- (id)initWithRequest:(RKRequest*)request {
|
||||
self = [self init];
|
||||
if (self) {
|
||||
_request = [request retain];
|
||||
// We don't retain here as we're letting RKRequestQueue manage
|
||||
// request ownership
|
||||
_request = request;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -71,7 +73,7 @@ extern NSString* cacheURLKey;
|
||||
- (id)initWithSynchronousRequest:(RKRequest*)request URLResponse:(NSHTTPURLResponse*)URLResponse body:(NSData*)body error:(NSError*)error {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_request = [request retain];
|
||||
_request = request;
|
||||
_httpURLResponse = [URLResponse retain];
|
||||
_failureError = [error retain];
|
||||
_body = [[NSMutableData dataWithData:body] retain];
|
||||
@@ -82,8 +84,6 @@ extern NSString* cacheURLKey;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[_request release];
|
||||
_request = nil;
|
||||
[_httpURLResponse release];
|
||||
_httpURLResponse = nil;
|
||||
[_body release];
|
||||
@@ -151,11 +151,8 @@ extern NSString* cacheURLKey;
|
||||
[[challenge sender] useCredential:newCredential
|
||||
forAuthenticationChallenge:challenge];
|
||||
} else {
|
||||
RKLogWarning(@"Failed authentication challenge after %ld failures", (long) [challenge previousFailureCount]);
|
||||
if ([[_request delegate] respondsToSelector:@selector(request:didFailAuthenticationChallenge:)]) {
|
||||
[[_request delegate] request:_request didFailAuthenticationChallenge:challenge];
|
||||
}
|
||||
[[challenge sender] cancelAuthenticationChallenge:challenge];
|
||||
RKLogWarning(@"Failed authentication challenge after %ld failures", (long) [challenge previousFailureCount]);
|
||||
[[challenge sender] cancelAuthenticationChallenge:challenge];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user