Adding configurable ASI_DEBUG_LOG macro
see ASIHTTPRequestConfig.h for additional information
Showing
3 changed files
with
62 additions
and
56 deletions
| @@ -207,7 +207,7 @@ | @@ -207,7 +207,7 @@ | ||
| 207 | [super buildPostBody]; | 207 | [super buildPostBody]; |
| 208 | 208 | ||
| 209 | #if DEBUG_FORM_DATA_REQUEST | 209 | #if DEBUG_FORM_DATA_REQUEST |
| 210 | - NSLog(@"%@",[self debugBodyString]); | 210 | + ASI_DEBUG_LOG(@"%@",[self debugBodyString]); |
| 211 | [self setDebugBodyString:nil]; | 211 | [self setDebugBodyString:nil]; |
| 212 | #endif | 212 | #endif |
| 213 | } | 213 | } |
| @@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
| 24 | #import "ASIDataCompressor.h" | 24 | #import "ASIDataCompressor.h" |
| 25 | 25 | ||
| 26 | // Automatically set on build | 26 | // Automatically set on build |
| 27 | -NSString *ASIHTTPRequestVersion = @"v1.8.1-33 2011-08-20"; | 27 | +NSString *ASIHTTPRequestVersion = @"v1.8.1-36 2011-08-30"; |
| 28 | 28 | ||
| 29 | static NSString *defaultUserAgent = nil; | 29 | static NSString *defaultUserAgent = nil; |
| 30 | 30 | ||
| @@ -696,7 +696,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -696,7 +696,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 696 | - (void)cancelOnRequestThread | 696 | - (void)cancelOnRequestThread |
| 697 | { | 697 | { |
| 698 | #if DEBUG_REQUEST_STATUS | 698 | #if DEBUG_REQUEST_STATUS |
| 699 | - NSLog(@"[STATUS] Request cancelled: %@",self); | 699 | + ASI_DEBUG_LOG(@"[STATUS] Request cancelled: %@",self); |
| 700 | #endif | 700 | #endif |
| 701 | 701 | ||
| 702 | [[self cancelledLock] lock]; | 702 | [[self cancelledLock] lock]; |
| @@ -786,7 +786,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -786,7 +786,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 786 | - (void)startSynchronous | 786 | - (void)startSynchronous |
| 787 | { | 787 | { |
| 788 | #if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING | 788 | #if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING |
| 789 | - NSLog(@"[STATUS] Starting synchronous request %@",self); | 789 | + ASI_DEBUG_LOG(@"[STATUS] Starting synchronous request %@",self); |
| 790 | #endif | 790 | #endif |
| 791 | [self setSynchronous:YES]; | 791 | [self setSynchronous:YES]; |
| 792 | [self setRunLoopMode:ASIHTTPRequestRunLoopMode]; | 792 | [self setRunLoopMode:ASIHTTPRequestRunLoopMode]; |
| @@ -811,7 +811,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -811,7 +811,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 811 | - (void)startAsynchronous | 811 | - (void)startAsynchronous |
| 812 | { | 812 | { |
| 813 | #if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING | 813 | #if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING |
| 814 | - NSLog(@"[STATUS] Starting asynchronous request %@",self); | 814 | + ASI_DEBUG_LOG(@"[STATUS] Starting asynchronous request %@",self); |
| 815 | #endif | 815 | #endif |
| 816 | [sharedQueue addOperation:self]; | 816 | [sharedQueue addOperation:self]; |
| 817 | } | 817 | } |
| @@ -962,7 +962,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -962,7 +962,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 962 | // Do we want to send credentials before we are asked for them? | 962 | // Do we want to send credentials before we are asked for them? |
| 963 | if (![self shouldPresentCredentialsBeforeChallenge]) { | 963 | if (![self shouldPresentCredentialsBeforeChallenge]) { |
| 964 | #if DEBUG_HTTP_AUTHENTICATION | 964 | #if DEBUG_HTTP_AUTHENTICATION |
| 965 | - NSLog(@"[AUTH] Request %@ will not send credentials to the server until it asks for them",self); | 965 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ will not send credentials to the server until it asks for them",self); |
| 966 | #endif | 966 | #endif |
| 967 | return; | 967 | return; |
| 968 | } | 968 | } |
| @@ -977,7 +977,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -977,7 +977,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 977 | [self addBasicAuthenticationHeaderWithUsername:[self username] andPassword:[self password]]; | 977 | [self addBasicAuthenticationHeaderWithUsername:[self username] andPassword:[self password]]; |
| 978 | 978 | ||
| 979 | #if DEBUG_HTTP_AUTHENTICATION | 979 | #if DEBUG_HTTP_AUTHENTICATION |
| 980 | - NSLog(@"[AUTH] Request %@ has a username and password set, and was manually configured to use BASIC. Will send credentials without waiting for an authentication challenge",self); | 980 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ has a username and password set, and was manually configured to use BASIC. Will send credentials without waiting for an authentication challenge",self); |
| 981 | #endif | 981 | #endif |
| 982 | 982 | ||
| 983 | } else { | 983 | } else { |
| @@ -996,12 +996,12 @@ static NSOperationQueue *sharedQueue = nil; | @@ -996,12 +996,12 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 996 | if (CFHTTPMessageApplyCredentialDictionary(request, (CFHTTPAuthenticationRef)[credentials objectForKey:@"Authentication"], (CFDictionaryRef)[credentials objectForKey:@"Credentials"], NULL)) { | 996 | if (CFHTTPMessageApplyCredentialDictionary(request, (CFHTTPAuthenticationRef)[credentials objectForKey:@"Authentication"], (CFDictionaryRef)[credentials objectForKey:@"Credentials"], NULL)) { |
| 997 | [self setAuthenticationScheme:[credentials objectForKey:@"AuthenticationScheme"]]; | 997 | [self setAuthenticationScheme:[credentials objectForKey:@"AuthenticationScheme"]]; |
| 998 | #if DEBUG_HTTP_AUTHENTICATION | 998 | #if DEBUG_HTTP_AUTHENTICATION |
| 999 | - NSLog(@"[AUTH] Request %@ found cached credentials (%@), will reuse without waiting for an authentication challenge",self,[credentials objectForKey:@"AuthenticationScheme"]); | 999 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ found cached credentials (%@), will reuse without waiting for an authentication challenge",self,[credentials objectForKey:@"AuthenticationScheme"]); |
| 1000 | #endif | 1000 | #endif |
| 1001 | } else { | 1001 | } else { |
| 1002 | [[self class] removeAuthenticationCredentialsFromSessionStore:[credentials objectForKey:@"Credentials"]]; | 1002 | [[self class] removeAuthenticationCredentialsFromSessionStore:[credentials objectForKey:@"Credentials"]]; |
| 1003 | #if DEBUG_HTTP_AUTHENTICATION | 1003 | #if DEBUG_HTTP_AUTHENTICATION |
| 1004 | - NSLog(@"[AUTH] Failed to apply cached credentials to request %@. These will be removed from the session store, and this request will wait for an authentication challenge",self); | 1004 | + ASI_DEBUG_LOG(@"[AUTH] Failed to apply cached credentials to request %@. These will be removed from the session store, and this request will wait for an authentication challenge",self); |
| 1005 | #endif | 1005 | #endif |
| 1006 | } | 1006 | } |
| 1007 | 1007 | ||
| @@ -1011,7 +1011,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1011,7 +1011,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 1011 | NSDictionary *usernameAndPassword = [credentials objectForKey:@"Credentials"]; | 1011 | NSDictionary *usernameAndPassword = [credentials objectForKey:@"Credentials"]; |
| 1012 | [self addBasicAuthenticationHeaderWithUsername:[usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationUsername] andPassword:[usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationPassword]]; | 1012 | [self addBasicAuthenticationHeaderWithUsername:[usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationUsername] andPassword:[usernameAndPassword objectForKey:(NSString *)kCFHTTPAuthenticationPassword]]; |
| 1013 | #if DEBUG_HTTP_AUTHENTICATION | 1013 | #if DEBUG_HTTP_AUTHENTICATION |
| 1014 | - NSLog(@"[AUTH] Request %@ found cached BASIC credentials from a previous request. Will send credentials without waiting for an authentication challenge",self); | 1014 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ found cached BASIC credentials from a previous request. Will send credentials without waiting for an authentication challenge",self); |
| 1015 | #endif | 1015 | #endif |
| 1016 | } | 1016 | } |
| 1017 | } | 1017 | } |
| @@ -1288,7 +1288,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1288,7 +1288,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 1288 | // Check if we should have expired this connection | 1288 | // Check if we should have expired this connection |
| 1289 | } else if ([[[self connectionInfo] objectForKey:@"expires"] timeIntervalSinceNow] < 0) { | 1289 | } else if ([[[self connectionInfo] objectForKey:@"expires"] timeIntervalSinceNow] < 0) { |
| 1290 | #if DEBUG_PERSISTENT_CONNECTIONS | 1290 | #if DEBUG_PERSISTENT_CONNECTIONS |
| 1291 | - NSLog(@"[CONNECTION] Not re-using connection #%i because it has expired",[[[self connectionInfo] objectForKey:@"id"] intValue]); | 1291 | + ASI_DEBUG_LOG(@"[CONNECTION] Not re-using connection #%i because it has expired",[[[self connectionInfo] objectForKey:@"id"] intValue]); |
| 1292 | #endif | 1292 | #endif |
| 1293 | [persistentConnectionsPool removeObject:[self connectionInfo]]; | 1293 | [persistentConnectionsPool removeObject:[self connectionInfo]]; |
| 1294 | [self setConnectionInfo:nil]; | 1294 | [self setConnectionInfo:nil]; |
| @@ -1296,7 +1296,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1296,7 +1296,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 1296 | } else if ([[self connectionInfo] objectForKey:@"request"] != nil) { | 1296 | } else if ([[self connectionInfo] objectForKey:@"request"] != nil) { |
| 1297 | //Some other request reused this connection already - we'll have to create a new one | 1297 | //Some other request reused this connection already - we'll have to create a new one |
| 1298 | #if DEBUG_PERSISTENT_CONNECTIONS | 1298 | #if DEBUG_PERSISTENT_CONNECTIONS |
| 1299 | - NSLog(@"%@ - Not re-using connection #%i for request #%i because it is already used by request #%i",self,[[[self connectionInfo] objectForKey:@"id"] intValue],[[self requestID] intValue],[[[self connectionInfo] objectForKey:@"request"] intValue]); | 1299 | + ASI_DEBUG_LOG(@"%@ - Not re-using connection #%i for request #%i because it is already used by request #%i",self,[[[self connectionInfo] objectForKey:@"id"] intValue],[[self requestID] intValue],[[[self connectionInfo] objectForKey:@"request"] intValue]); |
| 1300 | #endif | 1300 | #endif |
| 1301 | [self setConnectionInfo:nil]; | 1301 | [self setConnectionInfo:nil]; |
| 1302 | } | 1302 | } |
| @@ -1340,7 +1340,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1340,7 +1340,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 1340 | CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPAttemptPersistentConnection, kCFBooleanTrue); | 1340 | CFReadStreamSetProperty((CFReadStreamRef)[self readStream], kCFStreamPropertyHTTPAttemptPersistentConnection, kCFBooleanTrue); |
| 1341 | 1341 | ||
| 1342 | #if DEBUG_PERSISTENT_CONNECTIONS | 1342 | #if DEBUG_PERSISTENT_CONNECTIONS |
| 1343 | - NSLog(@"[CONNECTION] Request #%@ will use connection #%i",[self requestID],[[[self connectionInfo] objectForKey:@"id"] intValue]); | 1343 | + ASI_DEBUG_LOG(@"[CONNECTION] Request #%@ will use connection #%i",[self requestID],[[[self connectionInfo] objectForKey:@"id"] intValue]); |
| 1344 | #endif | 1344 | #endif |
| 1345 | 1345 | ||
| 1346 | 1346 | ||
| @@ -1351,7 +1351,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1351,7 +1351,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 1351 | 1351 | ||
| 1352 | } else { | 1352 | } else { |
| 1353 | #if DEBUG_PERSISTENT_CONNECTIONS | 1353 | #if DEBUG_PERSISTENT_CONNECTIONS |
| 1354 | - NSLog(@"[CONNECTION] Request %@ will not use a persistent connection",self); | 1354 | + ASI_DEBUG_LOG(@"[CONNECTION] Request %@ will not use a persistent connection",self); |
| 1355 | #endif | 1355 | #endif |
| 1356 | } | 1356 | } |
| 1357 | 1357 | ||
| @@ -1528,7 +1528,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1528,7 +1528,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 1528 | 1528 | ||
| 1529 | #if DEBUG_REQUEST_STATUS | 1529 | #if DEBUG_REQUEST_STATUS |
| 1530 | if ([self totalBytesSent] == [self postLength]) { | 1530 | if ([self totalBytesSent] == [self postLength]) { |
| 1531 | - NSLog(@"[STATUS] Request %@ finished uploading data",self); | 1531 | + ASI_DEBUG_LOG(@"[STATUS] Request %@ finished uploading data",self); |
| 1532 | } | 1532 | } |
| 1533 | #endif | 1533 | #endif |
| 1534 | } | 1534 | } |
| @@ -1985,7 +1985,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1985,7 +1985,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 1985 | - (void)requestFinished | 1985 | - (void)requestFinished |
| 1986 | { | 1986 | { |
| 1987 | #if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING | 1987 | #if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING |
| 1988 | - NSLog(@"[STATUS] Request finished: %@",self); | 1988 | + ASI_DEBUG_LOG(@"[STATUS] Request finished: %@",self); |
| 1989 | #endif | 1989 | #endif |
| 1990 | if ([self error] || [self mainRequest]) { | 1990 | if ([self error] || [self mainRequest]) { |
| 1991 | return; | 1991 | return; |
| @@ -2052,7 +2052,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2052,7 +2052,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2052 | - (void)failWithError:(NSError *)theError | 2052 | - (void)failWithError:(NSError *)theError |
| 2053 | { | 2053 | { |
| 2054 | #if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING | 2054 | #if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING |
| 2055 | - NSLog(@"[STATUS] Request %@: %@",self,(theError == ASIRequestCancelledError ? @"Cancelled" : @"Failed")); | 2055 | + ASI_DEBUG_LOG(@"[STATUS] Request %@: %@",self,(theError == ASIRequestCancelledError ? @"Cancelled" : @"Failed")); |
| 2056 | #endif | 2056 | #endif |
| 2057 | [self setComplete:YES]; | 2057 | [self setComplete:YES]; |
| 2058 | 2058 | ||
| @@ -2060,7 +2060,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2060,7 +2060,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2060 | if (theError && [theError code] != ASIAuthenticationErrorType && [theError code] != ASITooMuchRedirectionErrorType) { | 2060 | if (theError && [theError code] != ASIAuthenticationErrorType && [theError code] != ASITooMuchRedirectionErrorType) { |
| 2061 | [connectionsLock lock]; | 2061 | [connectionsLock lock]; |
| 2062 | #if DEBUG_PERSISTENT_CONNECTIONS | 2062 | #if DEBUG_PERSISTENT_CONNECTIONS |
| 2063 | - NSLog(@"[CONNECTION] Request #%@ failed and will invalidate connection #%@",[self requestID],[[self connectionInfo] objectForKey:@"id"]); | 2063 | + ASI_DEBUG_LOG(@"[CONNECTION] Request #%@ failed and will invalidate connection #%@",[self requestID],[[self connectionInfo] objectForKey:@"id"]); |
| 2064 | #endif | 2064 | #endif |
| 2065 | [[self connectionInfo] removeObjectForKey:@"request"]; | 2065 | [[self connectionInfo] removeObjectForKey:@"request"]; |
| 2066 | [persistentConnectionsPool removeObject:[self connectionInfo]]; | 2066 | [persistentConnectionsPool removeObject:[self connectionInfo]]; |
| @@ -2128,7 +2128,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2128,7 +2128,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2128 | 2128 | ||
| 2129 | #if DEBUG_REQUEST_STATUS | 2129 | #if DEBUG_REQUEST_STATUS |
| 2130 | if ([self totalBytesSent] == [self postLength]) { | 2130 | if ([self totalBytesSent] == [self postLength]) { |
| 2131 | - NSLog(@"[STATUS] Request %@ received response headers",self); | 2131 | + ASI_DEBUG_LOG(@"[STATUS] Request %@ received response headers",self); |
| 2132 | } | 2132 | } |
| 2133 | #endif | 2133 | #endif |
| 2134 | 2134 | ||
| @@ -2156,7 +2156,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2156,7 +2156,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2156 | } else { | 2156 | } else { |
| 2157 | #if DEBUG_HTTP_AUTHENTICATION | 2157 | #if DEBUG_HTTP_AUTHENTICATION |
| 2158 | if ([self authenticationScheme]) { | 2158 | if ([self authenticationScheme]) { |
| 2159 | - NSLog(@"[AUTH] Request %@ has passed %@ authentication",self,[self authenticationScheme]); | 2159 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ has passed %@ authentication",self,[self authenticationScheme]); |
| 2160 | } | 2160 | } |
| 2161 | #endif | 2161 | #endif |
| 2162 | } | 2162 | } |
| @@ -2168,7 +2168,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2168,7 +2168,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2168 | if (!requestAuthentication && [[self authenticationScheme] isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeBasic] && [self username] && [self password] && [self useSessionPersistence]) { | 2168 | if (!requestAuthentication && [[self authenticationScheme] isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeBasic] && [self username] && [self password] && [self useSessionPersistence]) { |
| 2169 | 2169 | ||
| 2170 | #if DEBUG_HTTP_AUTHENTICATION | 2170 | #if DEBUG_HTTP_AUTHENTICATION |
| 2171 | - NSLog(@"[AUTH] Request %@ passed BASIC authentication, and will save credentials in the session store for future use",self); | 2171 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ passed BASIC authentication, and will save credentials in the session store for future use",self); |
| 2172 | #endif | 2172 | #endif |
| 2173 | 2173 | ||
| 2174 | NSMutableDictionary *newCredentials = [NSMutableDictionary dictionaryWithCapacity:2]; | 2174 | NSMutableDictionary *newCredentials = [NSMutableDictionary dictionaryWithCapacity:2]; |
| @@ -2262,7 +2262,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2262,7 +2262,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2262 | [self setConnectionCanBeReused:YES]; | 2262 | [self setConnectionCanBeReused:YES]; |
| 2263 | [self setPersistentConnectionTimeoutSeconds:timeout]; | 2263 | [self setPersistentConnectionTimeoutSeconds:timeout]; |
| 2264 | #if DEBUG_PERSISTENT_CONNECTIONS | 2264 | #if DEBUG_PERSISTENT_CONNECTIONS |
| 2265 | - NSLog(@"[CONNECTION] Got a keep-alive header, will keep this connection open for %f seconds", [self persistentConnectionTimeoutSeconds]); | 2265 | + ASI_DEBUG_LOG(@"[CONNECTION] Got a keep-alive header, will keep this connection open for %f seconds", [self persistentConnectionTimeoutSeconds]); |
| 2266 | #endif | 2266 | #endif |
| 2267 | } | 2267 | } |
| 2268 | 2268 | ||
| @@ -2270,7 +2270,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2270,7 +2270,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2270 | } else { | 2270 | } else { |
| 2271 | [self setConnectionCanBeReused:YES]; | 2271 | [self setConnectionCanBeReused:YES]; |
| 2272 | #if DEBUG_PERSISTENT_CONNECTIONS | 2272 | #if DEBUG_PERSISTENT_CONNECTIONS |
| 2273 | - NSLog(@"[CONNECTION] Got no keep-alive header, will keep this connection open for %f seconds", [self persistentConnectionTimeoutSeconds]); | 2273 | + ASI_DEBUG_LOG(@"[CONNECTION] Got no keep-alive header, will keep this connection open for %f seconds", [self persistentConnectionTimeoutSeconds]); |
| 2274 | #endif | 2274 | #endif |
| 2275 | } | 2275 | } |
| 2276 | } | 2276 | } |
| @@ -2334,7 +2334,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2334,7 +2334,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2334 | [self setRequestCookies:[NSMutableArray array]]; | 2334 | [self setRequestCookies:[NSMutableArray array]]; |
| 2335 | 2335 | ||
| 2336 | #if DEBUG_REQUEST_STATUS | 2336 | #if DEBUG_REQUEST_STATUS |
| 2337 | - NSLog(@"[STATUS] Request will redirect (code: %i): %@",responseCode,self); | 2337 | + ASI_DEBUG_LOG(@"[STATUS] Request will redirect (code: %i): %@",responseCode,self); |
| 2338 | #endif | 2338 | #endif |
| 2339 | 2339 | ||
| 2340 | return YES; | 2340 | return YES; |
| @@ -2523,7 +2523,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2523,7 +2523,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2523 | if (user && pass) { | 2523 | if (user && pass) { |
| 2524 | 2524 | ||
| 2525 | #if DEBUG_HTTP_AUTHENTICATION | 2525 | #if DEBUG_HTTP_AUTHENTICATION |
| 2526 | - NSLog(@"[AUTH] Request %@ will use credentials set on its url",self); | 2526 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ will use credentials set on its url",self); |
| 2527 | #endif | 2527 | #endif |
| 2528 | 2528 | ||
| 2529 | } else { | 2529 | } else { |
| @@ -2534,7 +2534,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2534,7 +2534,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2534 | pass = [[self mainRequest] password]; | 2534 | pass = [[self mainRequest] password]; |
| 2535 | 2535 | ||
| 2536 | #if DEBUG_HTTP_AUTHENTICATION | 2536 | #if DEBUG_HTTP_AUTHENTICATION |
| 2537 | - NSLog(@"[AUTH] Request %@ will use credentials from its parent request",self); | 2537 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ will use credentials from its parent request",self); |
| 2538 | #endif | 2538 | #endif |
| 2539 | 2539 | ||
| 2540 | // Let's try to use the ones set in this object | 2540 | // Let's try to use the ones set in this object |
| @@ -2543,7 +2543,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2543,7 +2543,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2543 | pass = [self password]; | 2543 | pass = [self password]; |
| 2544 | 2544 | ||
| 2545 | #if DEBUG_HTTP_AUTHENTICATION | 2545 | #if DEBUG_HTTP_AUTHENTICATION |
| 2546 | - NSLog(@"[AUTH] Request %@ will use username and password properties as credentials",self); | 2546 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ will use username and password properties as credentials",self); |
| 2547 | #endif | 2547 | #endif |
| 2548 | } | 2548 | } |
| 2549 | } | 2549 | } |
| @@ -2556,7 +2556,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2556,7 +2556,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2556 | pass = [authenticationCredentials password]; | 2556 | pass = [authenticationCredentials password]; |
| 2557 | #if DEBUG_HTTP_AUTHENTICATION | 2557 | #if DEBUG_HTTP_AUTHENTICATION |
| 2558 | if (user && pass) { | 2558 | if (user && pass) { |
| 2559 | - NSLog(@"[AUTH] Request %@ will use credentials from the keychain",self); | 2559 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ will use credentials from the keychain",self); |
| 2560 | } | 2560 | } |
| 2561 | #endif | 2561 | #endif |
| 2562 | } | 2562 | } |
| @@ -2592,7 +2592,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2592,7 +2592,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2592 | - (void)retryUsingSuppliedCredentials | 2592 | - (void)retryUsingSuppliedCredentials |
| 2593 | { | 2593 | { |
| 2594 | #if DEBUG_HTTP_AUTHENTICATION | 2594 | #if DEBUG_HTTP_AUTHENTICATION |
| 2595 | - NSLog(@"[AUTH] Request %@ received credentials from its delegate or an ASIAuthenticationDialog, will retry",self); | 2595 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ received credentials from its delegate or an ASIAuthenticationDialog, will retry",self); |
| 2596 | #endif | 2596 | #endif |
| 2597 | //If the url was changed by the delegate, our CFHTTPMessageRef will be NULL and we'll go back to the start | 2597 | //If the url was changed by the delegate, our CFHTTPMessageRef will be NULL and we'll go back to the start |
| 2598 | if (!request) { | 2598 | if (!request) { |
| @@ -2606,7 +2606,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2606,7 +2606,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2606 | - (void)cancelAuthentication | 2606 | - (void)cancelAuthentication |
| 2607 | { | 2607 | { |
| 2608 | #if DEBUG_HTTP_AUTHENTICATION | 2608 | #if DEBUG_HTTP_AUTHENTICATION |
| 2609 | - NSLog(@"[AUTH] Request %@ had authentication cancelled by its delegate or an ASIAuthenticationDialog",self); | 2609 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ had authentication cancelled by its delegate or an ASIAuthenticationDialog",self); |
| 2610 | #endif | 2610 | #endif |
| 2611 | [self performSelector:@selector(failAuthentication) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO]; | 2611 | [self performSelector:@selector(failAuthentication) onThread:[[self class] threadForRequest:self] withObject:nil waitUntilDone:NO]; |
| 2612 | } | 2612 | } |
| @@ -2931,7 +2931,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2931,7 +2931,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2931 | 2931 | ||
| 2932 | if (!requestAuthentication) { | 2932 | if (!requestAuthentication) { |
| 2933 | #if DEBUG_HTTP_AUTHENTICATION | 2933 | #if DEBUG_HTTP_AUTHENTICATION |
| 2934 | - NSLog(@"[AUTH] Request %@ failed to read authentication information from response headers",self); | 2934 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ failed to read authentication information from response headers",self); |
| 2935 | #endif | 2935 | #endif |
| 2936 | 2936 | ||
| 2937 | [self cancelLoad]; | 2937 | [self cancelLoad]; |
| @@ -2953,9 +2953,9 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2953,9 +2953,9 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2953 | realm = @""; | 2953 | realm = @""; |
| 2954 | } | 2954 | } |
| 2955 | if ([self authenticationScheme] != (NSString *)kCFHTTPAuthenticationSchemeNTLM || [self authenticationRetryCount] == 0) { | 2955 | if ([self authenticationScheme] != (NSString *)kCFHTTPAuthenticationSchemeNTLM || [self authenticationRetryCount] == 0) { |
| 2956 | - NSLog(@"[AUTH] Request %@ received 401 challenge and must authenticate using %@%@",self,[self authenticationScheme],realm); | 2956 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ received 401 challenge and must authenticate using %@%@",self,[self authenticationScheme],realm); |
| 2957 | } else { | 2957 | } else { |
| 2958 | - NSLog(@"[AUTH] Request %@ NTLM handshake step %i",self,[self authenticationRetryCount]+1); | 2958 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ NTLM handshake step %i",self,[self authenticationRetryCount]+1); |
| 2959 | } | 2959 | } |
| 2960 | #endif | 2960 | #endif |
| 2961 | 2961 | ||
| @@ -2970,7 +2970,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2970,7 +2970,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2970 | if (err.domain == kCFStreamErrorDomainHTTP && (err.error == kCFStreamErrorHTTPAuthenticationBadUserName || err.error == kCFStreamErrorHTTPAuthenticationBadPassword)) { | 2970 | if (err.domain == kCFStreamErrorDomainHTTP && (err.error == kCFStreamErrorHTTPAuthenticationBadUserName || err.error == kCFStreamErrorHTTPAuthenticationBadPassword)) { |
| 2971 | 2971 | ||
| 2972 | #if DEBUG_HTTP_AUTHENTICATION | 2972 | #if DEBUG_HTTP_AUTHENTICATION |
| 2973 | - NSLog(@"[AUTH] Request %@ had bad credentials, will remove them from the session store if they are cached",self); | 2973 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ had bad credentials, will remove them from the session store if they are cached",self); |
| 2974 | #endif | 2974 | #endif |
| 2975 | 2975 | ||
| 2976 | // Prevent more than one request from asking for credentials at once | 2976 | // Prevent more than one request from asking for credentials at once |
| @@ -2984,7 +2984,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2984,7 +2984,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2984 | if ([self error] || [self isCancelled]) { | 2984 | if ([self error] || [self isCancelled]) { |
| 2985 | 2985 | ||
| 2986 | #if DEBUG_HTTP_AUTHENTICATION | 2986 | #if DEBUG_HTTP_AUTHENTICATION |
| 2987 | - NSLog(@"[AUTH] Request %@ failed or was cancelled while waiting to access credentials",self); | 2987 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ failed or was cancelled while waiting to access credentials",self); |
| 2988 | #endif | 2988 | #endif |
| 2989 | 2989 | ||
| 2990 | [delegateAuthenticationLock unlock]; | 2990 | [delegateAuthenticationLock unlock]; |
| @@ -2997,7 +2997,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2997,7 +2997,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2997 | if (credentials && [self applyCredentials:[credentials objectForKey:@"Credentials"]]) { | 2997 | if (credentials && [self applyCredentials:[credentials objectForKey:@"Credentials"]]) { |
| 2998 | 2998 | ||
| 2999 | #if DEBUG_HTTP_AUTHENTICATION | 2999 | #if DEBUG_HTTP_AUTHENTICATION |
| 3000 | - NSLog(@"[AUTH] Request %@ will reuse cached credentials from the session (%@)",self,[credentials objectForKey:@"AuthenticationScheme"]); | 3000 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ will reuse cached credentials from the session (%@)",self,[credentials objectForKey:@"AuthenticationScheme"]); |
| 3001 | #endif | 3001 | #endif |
| 3002 | 3002 | ||
| 3003 | [delegateAuthenticationLock unlock]; | 3003 | [delegateAuthenticationLock unlock]; |
| @@ -3011,7 +3011,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3011,7 +3011,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3011 | if ([self willAskDelegateForCredentials]) { | 3011 | if ([self willAskDelegateForCredentials]) { |
| 3012 | 3012 | ||
| 3013 | #if DEBUG_HTTP_AUTHENTICATION | 3013 | #if DEBUG_HTTP_AUTHENTICATION |
| 3014 | - NSLog(@"[AUTH] Request %@ will ask its delegate for credentials to use",self); | 3014 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ will ask its delegate for credentials to use",self); |
| 3015 | #endif | 3015 | #endif |
| 3016 | 3016 | ||
| 3017 | [delegateAuthenticationLock unlock]; | 3017 | [delegateAuthenticationLock unlock]; |
| @@ -3020,7 +3020,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3020,7 +3020,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3020 | if ([self showAuthenticationDialog]) { | 3020 | if ([self showAuthenticationDialog]) { |
| 3021 | 3021 | ||
| 3022 | #if DEBUG_HTTP_AUTHENTICATION | 3022 | #if DEBUG_HTTP_AUTHENTICATION |
| 3023 | - NSLog(@"[AUTH] Request %@ will ask ASIAuthenticationDialog for credentials",self); | 3023 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ will ask ASIAuthenticationDialog for credentials",self); |
| 3024 | #endif | 3024 | #endif |
| 3025 | 3025 | ||
| 3026 | [delegateAuthenticationLock unlock]; | 3026 | [delegateAuthenticationLock unlock]; |
| @@ -3030,7 +3030,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3030,7 +3030,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3030 | } | 3030 | } |
| 3031 | 3031 | ||
| 3032 | #if DEBUG_HTTP_AUTHENTICATION | 3032 | #if DEBUG_HTTP_AUTHENTICATION |
| 3033 | - NSLog(@"[AUTH] Request %@ has no credentials to present and must give up",self); | 3033 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ has no credentials to present and must give up",self); |
| 3034 | #endif | 3034 | #endif |
| 3035 | 3035 | ||
| 3036 | [self cancelLoad]; | 3036 | [self cancelLoad]; |
| @@ -3048,7 +3048,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3048,7 +3048,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3048 | // We've failed NTLM authentication twice, we should assume our credentials are wrong | 3048 | // We've failed NTLM authentication twice, we should assume our credentials are wrong |
| 3049 | } else if ([self authenticationScheme] == (NSString *)kCFHTTPAuthenticationSchemeNTLM && [self authenticationRetryCount ] == 2) { | 3049 | } else if ([self authenticationScheme] == (NSString *)kCFHTTPAuthenticationSchemeNTLM && [self authenticationRetryCount ] == 2) { |
| 3050 | #if DEBUG_HTTP_AUTHENTICATION | 3050 | #if DEBUG_HTTP_AUTHENTICATION |
| 3051 | - NSLog(@"[AUTH] Request %@ has failed NTLM authentication",self); | 3051 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ has failed NTLM authentication",self); |
| 3052 | #endif | 3052 | #endif |
| 3053 | 3053 | ||
| 3054 | [self failWithError:ASIAuthenticationError]; | 3054 | [self failWithError:ASIAuthenticationError]; |
| @@ -3056,7 +3056,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3056,7 +3056,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3056 | } else { | 3056 | } else { |
| 3057 | 3057 | ||
| 3058 | #if DEBUG_HTTP_AUTHENTICATION | 3058 | #if DEBUG_HTTP_AUTHENTICATION |
| 3059 | - NSLog(@"[AUTH] Request %@ had credentials and they were not marked as bad, but we got a 401 all the same.",self); | 3059 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ had credentials and they were not marked as bad, but we got a 401 all the same.",self); |
| 3060 | #endif | 3060 | #endif |
| 3061 | 3061 | ||
| 3062 | [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to apply credentials to request",NSLocalizedDescriptionKey,nil]]]; | 3062 | [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to apply credentials to request",NSLocalizedDescriptionKey,nil]]]; |
| @@ -3072,7 +3072,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3072,7 +3072,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3072 | if ([self error] || [self isCancelled]) { | 3072 | if ([self error] || [self isCancelled]) { |
| 3073 | 3073 | ||
| 3074 | #if DEBUG_HTTP_AUTHENTICATION | 3074 | #if DEBUG_HTTP_AUTHENTICATION |
| 3075 | - NSLog(@"[AUTH] Request %@ failed or was cancelled while waiting to access credentials",self); | 3075 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ failed or was cancelled while waiting to access credentials",self); |
| 3076 | #endif | 3076 | #endif |
| 3077 | 3077 | ||
| 3078 | [delegateAuthenticationLock unlock]; | 3078 | [delegateAuthenticationLock unlock]; |
| @@ -3085,7 +3085,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3085,7 +3085,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3085 | if (credentials && [self applyCredentials:[credentials objectForKey:@"Credentials"]]) { | 3085 | if (credentials && [self applyCredentials:[credentials objectForKey:@"Credentials"]]) { |
| 3086 | 3086 | ||
| 3087 | #if DEBUG_HTTP_AUTHENTICATION | 3087 | #if DEBUG_HTTP_AUTHENTICATION |
| 3088 | - NSLog(@"[AUTH] Request %@ will reuse cached credentials from the session (%@)",self,[credentials objectForKey:@"AuthenticationScheme"]); | 3088 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ will reuse cached credentials from the session (%@)",self,[credentials objectForKey:@"AuthenticationScheme"]); |
| 3089 | #endif | 3089 | #endif |
| 3090 | 3090 | ||
| 3091 | [delegateAuthenticationLock unlock]; | 3091 | [delegateAuthenticationLock unlock]; |
| @@ -3105,7 +3105,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3105,7 +3105,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3105 | [self startRequest]; | 3105 | [self startRequest]; |
| 3106 | } else { | 3106 | } else { |
| 3107 | #if DEBUG_HTTP_AUTHENTICATION | 3107 | #if DEBUG_HTTP_AUTHENTICATION |
| 3108 | - NSLog(@"[AUTH] Request %@ failed to apply credentials",self); | 3108 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ failed to apply credentials",self); |
| 3109 | #endif | 3109 | #endif |
| 3110 | [delegateAuthenticationLock unlock]; | 3110 | [delegateAuthenticationLock unlock]; |
| 3111 | [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to apply credentials to request",NSLocalizedDescriptionKey,nil]]]; | 3111 | [self failWithError:[NSError errorWithDomain:NetworkRequestErrorDomain code:ASIInternalErrorWhileApplyingCredentialsType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Failed to apply credentials to request",NSLocalizedDescriptionKey,nil]]]; |
| @@ -3115,7 +3115,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3115,7 +3115,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3115 | if ([self willAskDelegateForCredentials]) { | 3115 | if ([self willAskDelegateForCredentials]) { |
| 3116 | 3116 | ||
| 3117 | #if DEBUG_HTTP_AUTHENTICATION | 3117 | #if DEBUG_HTTP_AUTHENTICATION |
| 3118 | - NSLog(@"[AUTH] Request %@ will ask its delegate for credentials to use",self); | 3118 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ will ask its delegate for credentials to use",self); |
| 3119 | #endif | 3119 | #endif |
| 3120 | 3120 | ||
| 3121 | [delegateAuthenticationLock unlock]; | 3121 | [delegateAuthenticationLock unlock]; |
| @@ -3124,7 +3124,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3124,7 +3124,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3124 | if ([self showAuthenticationDialog]) { | 3124 | if ([self showAuthenticationDialog]) { |
| 3125 | 3125 | ||
| 3126 | #if DEBUG_HTTP_AUTHENTICATION | 3126 | #if DEBUG_HTTP_AUTHENTICATION |
| 3127 | - NSLog(@"[AUTH] Request %@ will ask ASIAuthenticationDialog for credentials",self); | 3127 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ will ask ASIAuthenticationDialog for credentials",self); |
| 3128 | #endif | 3128 | #endif |
| 3129 | 3129 | ||
| 3130 | [delegateAuthenticationLock unlock]; | 3130 | [delegateAuthenticationLock unlock]; |
| @@ -3132,7 +3132,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3132,7 +3132,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3132 | } | 3132 | } |
| 3133 | 3133 | ||
| 3134 | #if DEBUG_HTTP_AUTHENTICATION | 3134 | #if DEBUG_HTTP_AUTHENTICATION |
| 3135 | - NSLog(@"[AUTH] Request %@ has no credentials to present and must give up",self); | 3135 | + ASI_DEBUG_LOG(@"[AUTH] Request %@ has no credentials to present and must give up",self); |
| 3136 | #endif | 3136 | #endif |
| 3137 | [delegateAuthenticationLock unlock]; | 3137 | [delegateAuthenticationLock unlock]; |
| 3138 | [self failWithError:ASIAuthenticationError]; | 3138 | [self failWithError:ASIAuthenticationError]; |
| @@ -3373,7 +3373,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3373,7 +3373,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3373 | { | 3373 | { |
| 3374 | 3374 | ||
| 3375 | #if DEBUG_REQUEST_STATUS | 3375 | #if DEBUG_REQUEST_STATUS |
| 3376 | - NSLog(@"[STATUS] Request %@ finished downloading data (%qu bytes)",self, [self totalBytesRead]); | 3376 | + ASI_DEBUG_LOG(@"[STATUS] Request %@ finished downloading data (%qu bytes)",self, [self totalBytesRead]); |
| 3377 | #endif | 3377 | #endif |
| 3378 | [self setStatusTimer:nil]; | 3378 | [self setStatusTimer:nil]; |
| 3379 | [self setDownloadComplete:YES]; | 3379 | [self setDownloadComplete:YES]; |
| @@ -3471,7 +3471,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3471,7 +3471,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3471 | } | 3471 | } |
| 3472 | #if DEBUG_PERSISTENT_CONNECTIONS | 3472 | #if DEBUG_PERSISTENT_CONNECTIONS |
| 3473 | if ([self requestID]) { | 3473 | if ([self requestID]) { |
| 3474 | - NSLog(@"[CONNECTION] Request #%@ finished using connection #%@",[self requestID], [[self connectionInfo] objectForKey:@"id"]); | 3474 | + ASI_DEBUG_LOG(@"[CONNECTION] Request #%@ finished using connection #%@",[self requestID], [[self connectionInfo] objectForKey:@"id"]); |
| 3475 | } | 3475 | } |
| 3476 | #endif | 3476 | #endif |
| 3477 | [[self connectionInfo] removeObjectForKey:@"request"]; | 3477 | [[self connectionInfo] removeObjectForKey:@"request"]; |
| @@ -3612,7 +3612,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3612,7 +3612,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3612 | [self setWillRetryRequest:NO]; | 3612 | [self setWillRetryRequest:NO]; |
| 3613 | 3613 | ||
| 3614 | #if DEBUG_PERSISTENT_CONNECTIONS | 3614 | #if DEBUG_PERSISTENT_CONNECTIONS |
| 3615 | - NSLog(@"[CONNECTION] Request attempted to use connection #%@, but it has been closed - will retry with a new connection", [[self connectionInfo] objectForKey:@"id"]); | 3615 | + ASI_DEBUG_LOG(@"[CONNECTION] Request attempted to use connection #%@, but it has been closed - will retry with a new connection", [[self connectionInfo] objectForKey:@"id"]); |
| 3616 | #endif | 3616 | #endif |
| 3617 | [connectionsLock lock]; | 3617 | [connectionsLock lock]; |
| 3618 | [[self connectionInfo] removeObjectForKey:@"request"]; | 3618 | [[self connectionInfo] removeObjectForKey:@"request"]; |
| @@ -3624,7 +3624,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3624,7 +3624,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3624 | return YES; | 3624 | return YES; |
| 3625 | } | 3625 | } |
| 3626 | #if DEBUG_PERSISTENT_CONNECTIONS | 3626 | #if DEBUG_PERSISTENT_CONNECTIONS |
| 3627 | - NSLog(@"[CONNECTION] Request attempted to use connection #%@, but it has been closed - we have already retried with a new connection, so we must give up", [[self connectionInfo] objectForKey:@"id"]); | 3627 | + ASI_DEBUG_LOG(@"[CONNECTION] Request attempted to use connection #%@, but it has been closed - we have already retried with a new connection, so we must give up", [[self connectionInfo] objectForKey:@"id"]); |
| 3628 | #endif | 3628 | #endif |
| 3629 | return NO; | 3629 | return NO; |
| 3630 | } | 3630 | } |
| @@ -4012,7 +4012,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -4012,7 +4012,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 4012 | NSDictionary *existingConnection = [persistentConnectionsPool objectAtIndex:i]; | 4012 | NSDictionary *existingConnection = [persistentConnectionsPool objectAtIndex:i]; |
| 4013 | if (![existingConnection objectForKey:@"request"] && [[existingConnection objectForKey:@"expires"] timeIntervalSinceNow] <= 0) { | 4013 | if (![existingConnection objectForKey:@"request"] && [[existingConnection objectForKey:@"expires"] timeIntervalSinceNow] <= 0) { |
| 4014 | #if DEBUG_PERSISTENT_CONNECTIONS | 4014 | #if DEBUG_PERSISTENT_CONNECTIONS |
| 4015 | - NSLog(@"[CONNECTION] Closing connection #%i because it has expired",[[existingConnection objectForKey:@"id"] intValue]); | 4015 | + ASI_DEBUG_LOG(@"[CONNECTION] Closing connection #%i because it has expired",[[existingConnection objectForKey:@"id"] intValue]); |
| 4016 | #endif | 4016 | #endif |
| 4017 | NSInputStream *stream = [existingConnection objectForKey:@"stream"]; | 4017 | NSInputStream *stream = [existingConnection objectForKey:@"stream"]; |
| 4018 | if (stream) { | 4018 | if (stream) { |
| @@ -4468,14 +4468,14 @@ static NSOperationQueue *sharedQueue = nil; | @@ -4468,14 +4468,14 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 4468 | if ([self readStreamIsScheduled]) { | 4468 | if ([self readStreamIsScheduled]) { |
| 4469 | [self unscheduleReadStream]; | 4469 | [self unscheduleReadStream]; |
| 4470 | #if DEBUG_THROTTLING | 4470 | #if DEBUG_THROTTLING |
| 4471 | - NSLog(@"[THROTTLING] Sleeping request %@ until after %@",self,throttleWakeUpTime); | 4471 | + ASI_DEBUG_LOG(@"[THROTTLING] Sleeping request %@ until after %@",self,throttleWakeUpTime); |
| 4472 | #endif | 4472 | #endif |
| 4473 | } | 4473 | } |
| 4474 | } else { | 4474 | } else { |
| 4475 | if (![self readStreamIsScheduled]) { | 4475 | if (![self readStreamIsScheduled]) { |
| 4476 | [self scheduleReadStream]; | 4476 | [self scheduleReadStream]; |
| 4477 | #if DEBUG_THROTTLING | 4477 | #if DEBUG_THROTTLING |
| 4478 | - NSLog(@"[THROTTLING] Waking up request %@",self); | 4478 | + ASI_DEBUG_LOG(@"[THROTTLING] Waking up request %@",self); |
| 4479 | #endif | 4479 | #endif |
| 4480 | } | 4480 | } |
| 4481 | } | 4481 | } |
| @@ -4538,7 +4538,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -4538,7 +4538,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 4538 | } | 4538 | } |
| 4539 | } | 4539 | } |
| 4540 | #if DEBUG_THROTTLING | 4540 | #if DEBUG_THROTTLING |
| 4541 | - NSLog(@"[THROTTLING] ===Used: %u bytes of bandwidth in last measurement period===",bandwidthUsedInLastSecond); | 4541 | + ASI_DEBUG_LOG(@"[THROTTLING] ===Used: %u bytes of bandwidth in last measurement period===",bandwidthUsedInLastSecond); |
| 4542 | #endif | 4542 | #endif |
| 4543 | [bandwidthUsageTracker addObject:[NSNumber numberWithUnsignedLong:bandwidthUsedInLastSecond]]; | 4543 | [bandwidthUsageTracker addObject:[NSNumber numberWithUnsignedLong:bandwidthUsedInLastSecond]]; |
| 4544 | [bandwidthMeasurementDate release]; | 4544 | [bandwidthMeasurementDate release]; |
| @@ -11,6 +11,12 @@ | @@ -11,6 +11,12 @@ | ||
| 11 | // Debug output configuration options | 11 | // Debug output configuration options |
| 12 | // ====== | 12 | // ====== |
| 13 | 13 | ||
| 14 | +// If defined will use the specified function for debug logging | ||
| 15 | +// Otherwise use NSLog | ||
| 16 | +#ifndef ASI_DEBUG_LOG | ||
| 17 | + #define ASI_DEBUG_LOG NSLog | ||
| 18 | +#endif | ||
| 19 | + | ||
| 14 | // When set to 1 ASIHTTPRequests will print information about what a request is doing | 20 | // When set to 1 ASIHTTPRequests will print information about what a request is doing |
| 15 | #ifndef DEBUG_REQUEST_STATUS | 21 | #ifndef DEBUG_REQUEST_STATUS |
| 16 | #define DEBUG_REQUEST_STATUS 0 | 22 | #define DEBUG_REQUEST_STATUS 0 |
| @@ -33,5 +39,5 @@ | @@ -33,5 +39,5 @@ | ||
| 33 | 39 | ||
| 34 | // When set to 1, ASIHTTPRequests will print information about HTTP authentication (Basic, Digest or NTLM) to the console | 40 | // When set to 1, ASIHTTPRequests will print information about HTTP authentication (Basic, Digest or NTLM) to the console |
| 35 | #ifndef DEBUG_HTTP_AUTHENTICATION | 41 | #ifndef DEBUG_HTTP_AUTHENTICATION |
| 36 | -#define DEBUG_HTTP_AUTHENTICATION 0 | 42 | + #define DEBUG_HTTP_AUTHENTICATION 0 |
| 37 | #endif | 43 | #endif |
-
Please register or login to post a comment