o added -_refuseNewSessionsTimeInterval

o added +_setAllowsCacheControlHeader:
o added +_allowsCacheControlHeader


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@19043 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Manuel Guesdon 2004-04-06 11:13:07 +00:00
parent ff96e28f34
commit 81a1cd8f55
2 changed files with 52 additions and 0 deletions

View file

@ -489,6 +489,7 @@ extern BOOL WOStrictFlag;
-(void)setMinimumActiveSessionsCount:(int)aCount;
-(BOOL)isRefusingNewSessions;
-(void)refuseNewSessions:(BOOL)flag;
-(NSTimeInterval)_refuseNewSessionsTimeInterval;
-(void)logToMonitorWithFormat:(NSString*)aFormat;
-(void)terminateAfterTimeInterval:(NSTimeInterval)aTimeInterval;
@end
@ -617,6 +618,8 @@ extern BOOL WOStrictFlag;
+(void)setDefaultTemplateParser:(NSString*)defaultTemplateParser;//NDFN
+(BOOL)defaultDisplayExceptionPages;//NDFN
+(void)setDefaultDisplayExceptionPages:(BOOL)flag;//NDFN
+(void)_setAllowsCacheControlHeader:(BOOL)flag;
+(BOOL)_allowsCacheControlHeader;
@end
//====================================================================

View file

@ -435,6 +435,8 @@ int GSWApplicationMainReal(NSString* applicationClassName,
GSWOPTVALUE_AcceptedContentEncoding);
NSDebugFLLog(@"options",@"DisplayExceptionPages -> %@",
GSWOPTVALUE_DisplayExceptionPages);
NSDebugFLLog(@"options",@"DisplayExceptionPages -> %@",
GSWOPTVALUE_AllowsCacheControlHeader);
defaultsOptions =
[NSDictionary dictionaryWithObjectsAndKeys:
@ -563,6 +565,9 @@ int GSWApplicationMainReal(NSString* applicationClassName,
GSWOPTVALUE_DisplayExceptionPages,
GSWOPT_DisplayExceptionPages[GSWebNamingConv],
GSWOPTVALUE_AllowsCacheControlHeader,
GSWOPT_AllowsCacheControlHeader[GSWebNamingConv],
nil];
NSDebugFLLog(@"options",@"_globalAppDefaultOptions=%@",globalAppDefaultOptions);
@ -4327,6 +4332,34 @@ to another instance **/
};
};
//--------------------------------------------------------------------
-(NSTimeInterval)_refuseNewSessionsTimeInterval
{
NSTimeInterval ti=0;
NSTimeInterval sessionTimeOut=0;
int activeSessionsCount=0;
LOGObjectFnStart();
sessionTimeOut=[[self class]sessionTimeOutValue];
activeSessionsCount=[self activeSessionsCount];
if (activeSessionsCount>0) // Is there active sessions ?
{
// Wait for 1/4 of session time out
ti = sessionTimeOut / 4;
};
if (ti<15)
ti = 15;
NSDebugMLog(@"activeSessionsCount=%d sessionTimeOut=%f ==> refuseNewSessionsTimeInterval=%f",
activeSessionsCount,sessionTimeOut,ti);
LOGObjectFnStop();
return ti;
}
//--------------------------------------------------------------------
//logToMonitorWithFormat:
-(void)logToMonitorWithFormat:(NSString*)aFormat
@ -5204,6 +5237,7 @@ to another instance **/
LOGClassFnStop();
};
//--------------------------------------------------------------------
+(NSTimeInterval)sessionTimeOutValue
{
id sessionTimeOut=nil;
@ -5334,6 +5368,21 @@ to another instance **/
forKey:GSWOPT_DisplayExceptionPages[GSWebNamingConv]];
};
//--------------------------------------------------------------------
+(BOOL)_allowsCacheControlHeader
{
return [[[NSUserDefaults standardUserDefaults]
objectForKey:GSWOPT_AllowsCacheControlHeader[GSWebNamingConv]] boolValue];
};
//--------------------------------------------------------------------
+(void)_setAllowsCacheControlHeader:(BOOL)flag
{
[[NSUserDefaults standardUserDefaults]
setObject:[NSNumber numberWithBool:flag]
forKey:GSWOPT_AllowsCacheControlHeader[GSWebNamingConv]];
};
@end