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:
mguesdon 2004-04-06 11:13:07 +00:00
parent c0e11bd5dc
commit d37bc14502
2 changed files with 52 additions and 0 deletions

View file

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

View file

@ -435,6 +435,8 @@ int GSWApplicationMainReal(NSString* applicationClassName,
GSWOPTVALUE_AcceptedContentEncoding); GSWOPTVALUE_AcceptedContentEncoding);
NSDebugFLLog(@"options",@"DisplayExceptionPages -> %@", NSDebugFLLog(@"options",@"DisplayExceptionPages -> %@",
GSWOPTVALUE_DisplayExceptionPages); GSWOPTVALUE_DisplayExceptionPages);
NSDebugFLLog(@"options",@"DisplayExceptionPages -> %@",
GSWOPTVALUE_AllowsCacheControlHeader);
defaultsOptions = defaultsOptions =
[NSDictionary dictionaryWithObjectsAndKeys: [NSDictionary dictionaryWithObjectsAndKeys:
@ -563,6 +565,9 @@ int GSWApplicationMainReal(NSString* applicationClassName,
GSWOPTVALUE_DisplayExceptionPages, GSWOPTVALUE_DisplayExceptionPages,
GSWOPT_DisplayExceptionPages[GSWebNamingConv], GSWOPT_DisplayExceptionPages[GSWebNamingConv],
GSWOPTVALUE_AllowsCacheControlHeader,
GSWOPT_AllowsCacheControlHeader[GSWebNamingConv],
nil]; nil];
NSDebugFLLog(@"options",@"_globalAppDefaultOptions=%@",globalAppDefaultOptions); 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: //logToMonitorWithFormat:
-(void)logToMonitorWithFormat:(NSString*)aFormat -(void)logToMonitorWithFormat:(NSString*)aFormat
@ -5204,6 +5237,7 @@ to another instance **/
LOGClassFnStop(); LOGClassFnStop();
}; };
//--------------------------------------------------------------------
+(NSTimeInterval)sessionTimeOutValue +(NSTimeInterval)sessionTimeOutValue
{ {
id sessionTimeOut=nil; id sessionTimeOut=nil;
@ -5334,6 +5368,21 @@ to another instance **/
forKey:GSWOPT_DisplayExceptionPages[GSWebNamingConv]]; 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 @end