(fix) make sure we don't consider SOGoMaximumRequestCount when it is 0

pull/215/head
Ludovic Marcotte 2016-03-21 08:19:40 -04:00
parent 69d90e1fad
commit b115f26834
1 changed files with 4 additions and 5 deletions

View File

@ -425,6 +425,8 @@ static BOOL debugLeaks;
{
static NSArray *runLoopModes = nil;
static BOOL debugOn = NO;
SOGoSystemDefaults *sd;
WOResponse *resp;
NSDate *startDate;
NSString *path;
@ -438,6 +440,7 @@ static BOOL debugLeaks;
startDate = [NSDate date];
}
sd = [SOGoSystemDefaults sharedSystemDefaults];
cache = [SOGoCache sharedCache];
#ifdef GNUSTEP_BASE_LIBRARY
if (debugLeaks)
@ -455,7 +458,7 @@ static BOOL debugLeaks;
// We check for rate-limiting settings - ignore anything actually
// sent to /SOGo/ (so unauthenticated requests).
path = [_request requestHandlerPath];
if ([path length])
if ([path length] && [sd maximumRequestCount] > 0)
{
NSDictionary *requestCount;
NSString *username;
@ -473,12 +476,8 @@ static BOOL debugLeaks;
if (requestCount)
{
SOGoSystemDefaults *sd;
unsigned int current_time, start_time, delta, block_time, request_count;
sd = [SOGoSystemDefaults sharedSystemDefaults];
current_time = [[NSCalendarDate date] timeIntervalSince1970];
start_time = [[requestCount objectForKey: @"InitialDate"] unsignedIntValue];
delta = current_time - start_time;