mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
pick the debug mode from environment
This commit is contained in:
parent
1cf39479b6
commit
d498642de5
10 changed files with 45 additions and 124 deletions
|
@ -246,10 +246,7 @@ static NSMapTable *_flagMap = nil;
|
|||
NSData *content = [request convertToData];
|
||||
|
||||
[self setFlags: SENTREQUEST];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set SENTREQUEST (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set SENTREQUEST (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
|
||||
// TODO: more comparisons of _request and request
|
||||
if ([method isEqualToString: @"POST"] ||
|
||||
|
@ -258,19 +255,13 @@ static NSMapTable *_flagMap = nil;
|
|||
if ([content isEqualToData: [_request HTTPBody]])
|
||||
{
|
||||
[self setFlags: GOTREQUEST];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set GOTREQUEST (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set GOTREQUEST (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setFlags: GOTREQUEST];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set GOTREQUEST (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set GOTREQUEST (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,10 +270,7 @@ willSendUnauthorized:(GSMimeDocument *)response
|
|||
with:(TestWebServer *)server
|
||||
{
|
||||
[self setFlags: NOTAUTHORIZED];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set NOTAUTHORIZED (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set NOTAUTHORIZED (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
|
||||
- (void)handler:(id)handler
|
||||
|
@ -290,10 +278,7 @@ willSendUnauthorized:(GSMimeDocument *)response
|
|||
with:(TestWebServer *)server
|
||||
{
|
||||
[self setFlags: AUTHORIZED];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set AUTHORIZED (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set AUTHORIZED (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
|
||||
- (void)handler:(id)handler
|
||||
|
@ -301,10 +286,7 @@ willSendUnauthorized:(GSMimeDocument *)response
|
|||
with:(TestWebServer *)server
|
||||
{
|
||||
[self setFlags: SENTRESPONSE];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set SENTRESPONSE (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set SENTRESPONSE (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
|
||||
- (void)timeoutExceededByHandler:(id)handler
|
||||
|
@ -323,19 +305,13 @@ willSendUnauthorized:(GSMimeDocument *)response
|
|||
if ([(NSHTTPURLResponse *)redirectResponse statusCode] == _redirectStatusCode)
|
||||
{
|
||||
[self setFlags: GOTREDIRECT];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set GOTREDIRECT (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set GOTREDIRECT (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setFlags: GOTREDIRECT];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set GOTREDIRECT (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set GOTREDIRECT (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
|
||||
return _redirectRequest;
|
||||
|
@ -345,10 +321,7 @@ willSendUnauthorized:(GSMimeDocument *)response
|
|||
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
|
||||
{
|
||||
[self setFlags: GOTUNAUTHORIZED];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set GOTUNAUTHORIZED (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set GOTUNAUTHORIZED (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
|
||||
if ([challenge previousFailureCount] == 0)
|
||||
{
|
||||
|
@ -401,19 +374,13 @@ didReceiveResponse:(NSURLResponse *)response
|
|||
if ([(NSHTTPURLResponse *)response statusCode] == _expectedStatusCode)
|
||||
{
|
||||
[self setFlags: GOTRESPONSE];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set GOTRESPONSE (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set GOTRESPONSE (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setFlags: GOTRESPONSE];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set GOTRESPONSE (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set GOTRESPONSE (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,10 +388,7 @@ didReceiveResponse:(NSURLResponse *)response
|
|||
didReceiveData:(NSData *)data
|
||||
{
|
||||
[_received appendData: data];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: received data '%@' (-[%@])", self, data, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: received data '%@' (-[%@])", self, data, NSStringFromSelector(_cmd));
|
||||
}
|
||||
|
||||
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
|
||||
|
@ -433,17 +397,11 @@ didReceiveResponse:(NSURLResponse *)response
|
|||
[_received isEqualToData: _expectedContent])
|
||||
{
|
||||
[self setFlags: GOTCONTENT];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set GOTCONTENT (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set GOTCONTENT (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
|
||||
[self setFlags: GOTFINISH];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set GOTFINISH (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
}
|
||||
NSDebugLog(@"%@: set GOTFINISH (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
|
||||
_done = YES;
|
||||
}
|
||||
|
@ -461,11 +419,8 @@ didReceiveResponse:(NSURLResponse *)response
|
|||
*/
|
||||
|
||||
[self setFlags: GOTFAIL];
|
||||
if (YES == _debug)
|
||||
{
|
||||
NSLog(@"%@: set GOTFAIL (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
NSLog(@"%@: error %@", self, error);
|
||||
}
|
||||
NSDebugLog(@"%@: set GOTFAIL (-[%@])", self, NSStringFromSelector(_cmd));
|
||||
NSDebugLog(@"%@: error %@", self, error);
|
||||
|
||||
_done = YES;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue