2003-02-01 Manuel Guesdon <mguesdon@orange-concept.com>

* GSWeb/NSString+Trimming.m:
		o Replaced DataToHexString with -[NSData
		 hexadecimalRepresentation]. (David Ayers <d.ayers@inode.at>)
	* GSWeb/GSWHTMLURLValuesElement.m:
		o Replaced GSMD5 class with md5Digest of NSData category.
		 (David Ayers <d.ayers@inode.at>)
		o Replaced DataToHexString with -[NSData
		 hexadecimalRepresentation].  (David Ayers <d.ayers@inode.at>)
	* Examples/hello/GNUmakefile:
		o Use gsweb.make.
	* gsweb.make.in:
		o Change AUXILIARY_INCLUDE_LIBS to AUXILIARY_TOOL_LIB.
		 (David Ayers <d.ayers@inode.at>)
		o Handle GDL2 with ADDITIONAL_OBJCFLAGS.
		 (David Ayers <d.ayers@inode.at>)
	* configure.ac:
		o Check for GDL2 to set config.h correctly.
	* configure:
		o Regenerated. (David Ayers <d.ayers@inode.at>)
	* config.mak.in:
		o Set GDL2 as determined by configure. (David Ayers <d.ayers@inode.at>)
	* GSWeb.framework/GSWComponent.m:
		o use GSWApp -createResponseInContext: instead of creating
			GSWResponse instance directly
		o added -_appendPageToResponse:inContext:
	* GSWeb.framework/GSWApplication.[hm]:
		o added -createResponseInContext:
		o added -createRequestWithMethod:uri:httpVersion:headers:content:userInfo:
		o added -createResourceManager
		o used createResourceManager instead of creating it directly
		o added NSAutoreleasePool debug traces
		o exception log changed
	* GSWeb.framework/GSWDefaultAdaptorThread.m:
		o use application -createRequestWithMethod:uri:httpVersion:headers:content:userInfo:
			instead of directly creating GSWRequest instance directly
		o added NSAutoreleasePool debug traces
	 	o add thread_id trace in log
	* GSWeb.framework/GSWDefaultAdaptor.m:
		o added NSAutoreleasePool debug traces
	* GSWeb.framework/GSWComponentRequestHandler.m:
		o use GSWApp -createResponseInContext: instead of creating
			GSWResponse instance directly
	* GSWeb.framework/GSWResourceRequestHandler.m:
		o use GSWApp -createResponseInContext: instead of creating
			GSWResponse instance directly
	* GSWeb.framework/GSWDirectActionRequestHandler.m:
		o use GSWApp -createResponseInContext: instead of creating
			GSWResponse instance directly
	* GSWeb.framework/GSWResponse.m:
		o use GSWApp -createResponseInContext: instead of creating
			GSWResponse instance directly
	* GSWeb.framework/GSWTemplateParserXML.m:
		o added exception handling
		o added NSAutoreleasePool debug traces
	* GSWeb.framework/GSWTemplateParser.m:
		o added NSAutoreleasePool debug traces
	* GSWeb.framework/GSWSession.m
		o added NSAutoreleasePool debug traces
		o Fix in rand() use
		o NSString+Trimming
		o Fix in rand() use
	 	o add thread_id trace in log
		o Replaced GSMD5 class with md5Digest of NSData category.
		  (David Ayers <d.ayers@inode.at>)
		o Replaced DataToHexString with -[NSData
		hexadecimalRepresentation].  (David Ayers <d.ayers@inode.at>)
	* GSWeb.framework/GSWContext.m
		o add thread_id trace in log
	* GSWeb/GSWUtils.[hm]:
		o Removed DataToHexString() and HexStringToData().
		  (David Ayers <d.ayers@inode.at>)


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@15846 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Manuel Guesdon 2003-02-01 19:07:25 +00:00
parent 27fa568860
commit f14b5bf8da
24 changed files with 535 additions and 369 deletions

View file

@ -1,3 +1,77 @@
2003-02-01 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb/NSString+Trimming.m:
o Replaced DataToHexString with -[NSData
hexadecimalRepresentation]. (David Ayers <d.ayers@inode.at>)
* GSWeb/GSWHTMLURLValuesElement.m:
o Replaced GSMD5 class with md5Digest of NSData category.
(David Ayers <d.ayers@inode.at>)
o Replaced DataToHexString with -[NSData
hexadecimalRepresentation]. (David Ayers <d.ayers@inode.at>)
* Examples/hello/GNUmakefile:
o Use gsweb.make.
* gsweb.make.in:
o Change AUXILIARY_INCLUDE_LIBS to AUXILIARY_TOOL_LIB.
(David Ayers <d.ayers@inode.at>)
o Handle GDL2 with ADDITIONAL_OBJCFLAGS.
(David Ayers <d.ayers@inode.at>)
* configure.ac:
o Check for GDL2 to set config.h correctly.
* configure:
o Regenerated. (David Ayers <d.ayers@inode.at>)
* config.mak.in:
o Set GDL2 as determined by configure. (David Ayers <d.ayers@inode.at>)
* GSWeb.framework/GSWComponent.m:
o use GSWApp -createResponseInContext: instead of creating
GSWResponse instance directly
o added -_appendPageToResponse:inContext:
* GSWeb.framework/GSWApplication.[hm]:
o added -createResponseInContext:
o added -createRequestWithMethod:uri:httpVersion:headers:content:userInfo:
o added -createResourceManager
o used createResourceManager instead of creating it directly
o added NSAutoreleasePool debug traces
o exception log changed
* GSWeb.framework/GSWDefaultAdaptorThread.m:
o use application -createRequestWithMethod:uri:httpVersion:headers:content:userInfo:
instead of directly creating GSWRequest instance directly
o added NSAutoreleasePool debug traces
o add thread_id trace in log
* GSWeb.framework/GSWDefaultAdaptor.m:
o added NSAutoreleasePool debug traces
* GSWeb.framework/GSWComponentRequestHandler.m:
o use GSWApp -createResponseInContext: instead of creating
GSWResponse instance directly
* GSWeb.framework/GSWResourceRequestHandler.m:
o use GSWApp -createResponseInContext: instead of creating
GSWResponse instance directly
* GSWeb.framework/GSWDirectActionRequestHandler.m:
o use GSWApp -createResponseInContext: instead of creating
GSWResponse instance directly
* GSWeb.framework/GSWResponse.m:
o use GSWApp -createResponseInContext: instead of creating
GSWResponse instance directly
* GSWeb.framework/GSWTemplateParserXML.m:
o added exception handling
o added NSAutoreleasePool debug traces
* GSWeb.framework/GSWTemplateParser.m:
o added NSAutoreleasePool debug traces
* GSWeb.framework/GSWSession.m
o added NSAutoreleasePool debug traces
o Fix in rand() use
o NSString+Trimming
o Fix in rand() use
o add thread_id trace in log
o Replaced GSMD5 class with md5Digest of NSData category.
(David Ayers <d.ayers@inode.at>)
o Replaced DataToHexString with -[NSData
hexadecimalRepresentation]. (David Ayers <d.ayers@inode.at>)
* GSWeb.framework/GSWContext.m
o add thread_id trace in log
* GSWeb/GSWUtils.[hm]:
o Removed DataToHexString() and HexStringToData().
(David Ayers <d.ayers@inode.at>)
2003-01-22 Manuel Guesdon <mguesdon@orange-concept.com> 2003-01-22 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/WebObjects: removed WO* * GSWeb.framework/WebObjects: removed WO*

View file

@ -28,6 +28,7 @@ GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
GNUSTEP_MAKEFILES = $(GNUSTEP_SYSTEM_ROOT)/Makefiles GNUSTEP_MAKEFILES = $(GNUSTEP_SYSTEM_ROOT)/Makefiles
include $(GNUSTEP_MAKEFILES)/common.make include $(GNUSTEP_MAKEFILES)/common.make
include $(GNUSTEP_MAKEFILES)/Auxiliary/gsweb.make
include config.mak include config.mak

View file

@ -1,12 +1,13 @@
/** GSWApplication.h - <title>GSWeb: Class GSWApplication</title> /** GSWApplication.h - <title>GSWeb: Class GSWApplication</title>
Copyright (C) 1999-2002 Free Software Foundation, Inc. Copyright (C) 1999-2003 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$ $Revision$
$Date$ $Date$
$Id$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
@ -168,6 +169,14 @@ extern BOOL WOStrictFlag;
//==================================================================== //====================================================================
@interface GSWApplication (GSWApplicationE) @interface GSWApplication (GSWApplicationE)
-(GSWResponse*)createResponseInContext:(GSWContext*)aContext;
-(GSWRequest*)createRequestWithMethod:(NSString*)aMethod
uri:(NSString*)anURL
httpVersion:(NSString*)aVersion
headers:(NSDictionary*)headers
content:(NSData*)content
userInfo:(NSDictionary*)userInfo;
-(GSWResourceManager*)createResourceManager;
-(void)_discountTerminatedSession; -(void)_discountTerminatedSession;
-(void)_finishInitializingSession:(GSWSession*)aSession; -(void)_finishInitializingSession:(GSWSession*)aSession;
-(GSWSession*)_initializeSessionInContext:(GSWContext*)aContext; -(GSWSession*)_initializeSessionInContext:(GSWContext*)aContext;

View file

@ -178,6 +178,7 @@ int GSWApplicationMainReal(NSString* applicationClassName,
NSAutoreleasePool *appAutoreleasePool=nil; NSAutoreleasePool *appAutoreleasePool=nil;
appAutoreleasePool = [NSAutoreleasePool new]; appAutoreleasePool = [NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",appAutoreleasePool);
/* /*
//TODO //TODO
DebugInstall("/dvlp/projects/app/Source/app.gswa/shared_debug_obj/ix86/linux-gnu/gnu-gnu-gnu-xgps/app_server"); DebugInstall("/dvlp/projects/app/Source/app.gswa/shared_debug_obj/ix86/linux-gnu/gnu-gnu-gnu-xgps/app_server");
@ -479,6 +480,7 @@ int GSWApplicationMainReal(NSString* applicationClassName,
[GSWApp run]; [GSWApp run];
DESTROY(GSWApp); DESTROY(GSWApp);
}; };
GSWLogMemCF("Destroy NSAutoreleasePool: %p",appAutoreleasePool);
DESTROY(appAutoreleasePool); DESTROY(appAutoreleasePool);
return result; return result;
}; };
@ -571,7 +573,7 @@ int GSWApplicationMain(NSString* applicationClassName,
//call adaptorsDispatchRequestsConcurrently //call adaptorsDispatchRequestsConcurrently
_activeSessionsCountLock=[NSLock new]; _activeSessionsCountLock=[NSLock new];
_componentDefinitionCache=[GSWMultiKeyDictionary new]; _componentDefinitionCache=[GSWMultiKeyDictionary new];
[self setResourceManager:[[GSWResourceManager new]autorelease]]; [self setResourceManager:[self createResourceManager]];
[self setStatisticsStore:[[GSWStatisticsStore new]autorelease]]; [self setStatisticsStore:[[GSWStatisticsStore new]autorelease]];
if ([[self class]isMonitorEnabled]) if ([[self class]isMonitorEnabled])
{ {
@ -777,10 +779,10 @@ int GSWApplicationMain(NSString* applicationClassName,
} }
NS_HANDLER NS_HANDLER
{ {
NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p", NSDebugMLog(@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
_globalLockn, _globalLockn,
(void*)_globalLock_thread_id, (void*)_globalLock_thread_id,
(void*)objc_thread_id()); (void*)objc_thread_id());
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
@"globalLock tmpunlock"); @"globalLock tmpunlock");
LOGException(@"%@ (%@)",localException,[localException reason]); LOGException(@"%@ (%@)",localException,[localException reason]);
@ -1409,6 +1411,31 @@ selfLockn,
//==================================================================== //====================================================================
@implementation GSWApplication (GSWApplicationE) @implementation GSWApplication (GSWApplicationE)
-(GSWResponse*)createResponseInContext:(GSWContext*)aContext
{
return [[GSWResponse new]autorelease];
};
-(GSWRequest*)createRequestWithMethod:(NSString*)aMethod
uri:(NSString*)anURL
httpVersion:(NSString*)aVersion
headers:(NSDictionary*)headers
content:(NSData*)content
userInfo:(NSDictionary*)userInfo
{
return [[[GSWRequest alloc]initWithMethod:aMethod
uri:anURL
httpVersion:aVersion
headers:headers
content:content
userInfo:userInfo]autorelease];
};
-(GSWResourceManager*)createResourceManager
{
return [[GSWResourceManager new]autorelease];
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)_discountTerminatedSession -(void)_discountTerminatedSession
{ {

View file

@ -1564,8 +1564,20 @@ associationsKeys:(NSArray*)associationsKeys
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(GSWResponse*)_generateResponseInContext:(GSWContext*)aContext -(GSWResponse*)_generateResponseInContext:(GSWContext*)aContext
{ {
//OK
GSWResponse* response=nil; GSWResponse* response=nil;
LOGObjectFnStart();
NSAssert(aContext,@"No context");
response=[GSWApp createResponseInContext:aContext];
[self _appendPageToResponse:response
inContext:aContext];
return response;
};
//--------------------------------------------------------------------
-(void)_appendPageToResponse:(GSWResponse*)response
inContext:(GSWContext*)aContext
{
//OK
GSWSession* session=nil; GSWSession* session=nil;
GSWRequest* request=nil; GSWRequest* request=nil;
NSString* httpVersion=nil; NSString* httpVersion=nil;
@ -1575,8 +1587,6 @@ associationsKeys:(NSArray*)associationsKeys
NSAssert(aContext,@"No context"); NSAssert(aContext,@"No context");
NS_DURING NS_DURING
{ {
response=[[GSWResponse new]autorelease];
[aContext deleteAllElementIDComponents]; [aContext deleteAllElementIDComponents];
request=[aContext request]; request=[aContext request];
NSDebugMLLog(@"GSWComponent",@"request=%@",request); NSDebugMLLog(@"GSWComponent",@"request=%@",request);
@ -1648,7 +1658,6 @@ associationsKeys:(NSArray*)associationsKeys
}; };
NS_ENDHANDLER; NS_ENDHANDLER;
LOGObjectFnStop(); LOGObjectFnStop();
return response;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View file

@ -364,7 +364,7 @@ static const char rcsId[] = "$Id$";
contextID=[elements objectForKey:GSWKey_ContextID[GSWebNamingConv]]; contextID=[elements objectForKey:GSWKey_ContextID[GSWebNamingConv]];
NSDebugMLLog(@"requests",@"contextID=%@",contextID); NSDebugMLLog(@"requests",@"contextID=%@",contextID);
response=[[GSWResponse new]autorelease]; response=[GSWApp createResponseInContext:aContext];
NSDebugMLLog(@"requests",@"response=%@",response); NSDebugMLLog(@"requests",@"response=%@",response);
NSDebugMLLog(@"requests",@"aSession=%@",aSession); NSDebugMLLog(@"requests",@"aSession=%@",aSession);
NSDebugMLLog(@"requests",@"aContext=%@",aContext); NSDebugMLLog(@"requests",@"aContext=%@",aContext);

View file

@ -55,7 +55,7 @@ static int dontTraceComponentActionURL=0;
-(void)dealloc -(void)dealloc
{ {
GSWLogAssertGood(self); GSWLogAssertGood(self);
NSDebugFLog(@"Dealloc GSWContext %p",(void*)self); NSDebugFLog(@"Dealloc GSWContext %p. ThreadID=%p",(void*)self,(void*)objc_thread_id());
NSDebugFLog0(@"Release GSWContext senderID"); NSDebugFLog0(@"Release GSWContext senderID");
DESTROY(_senderID); DESTROY(_senderID);
NSDebugFLog0(@"Release GSWContext requestSessionID"); NSDebugFLog0(@"Release GSWContext requestSessionID");

View file

@ -41,8 +41,10 @@ extern void GSWLogAssertGoodFn(CONST char* file,int line,NSObject* object);
//Log Memory Alloc/Dealloc //Log Memory Alloc/Dealloc
#ifdef GSWDEBUG_MEM #ifdef GSWDEBUG_MEM
#define GSWLogMemC(cString); GSWLogC_(__FILE__,__LINE__,cString); #define GSWLogMemC(cString); GSWLogC_(__FILE__,__LINE__,cString);
#define GSWLogMemCF(format,...); { fprintf(stderr,"File %s: %d. ",file,line); fprintf(stderr,format, ## args); };
#else #else
#define GSWLogMemC(cString); #define GSWLogMemC(cString);
#define GSWLogMemCF(format,...);
#endif #endif
//Log Locks //Log Locks
@ -64,6 +66,7 @@ extern void GSWLogAssertGoodFn(CONST char* file,int line,NSObject* object);
#define GSWLogDumpObject(object,deep); {} #define GSWLogDumpObject(object,deep); {}
#define GSWLogAssertGood(object); {} #define GSWLogAssertGood(object); {}
#define GSWLogMemC(cString); {} #define GSWLogMemC(cString); {}
#define GSWLogMemCF(cString,...); {}
#define GSWLogLockC(cString); {} #define GSWLogLockC(cString); {}
#define GSWLogDeepC(cString); {} #define GSWLogDeepC(cString); {}
#endif #endif

View file

@ -1,11 +1,13 @@
/** GSWDefaultAdaptor.m - <title>GSWeb: Class GSWDefaultAdaptor</title> /** GSWDefaultAdaptor.m - <title>GSWeb: Class GSWDefaultAdaptor</title>
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Copyright (C) 1999-2003 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999 Date: Jan 1999
$Revision$ $Revision$
$Date$ $Date$
$Id$
<abstract></abstract> <abstract></abstract>
@ -28,7 +30,7 @@
</license> </license>
**/ **/
static char rcsId[] = "$Id$"; static const char rcsId[] = "$Id$";
#include "GSWeb.h" #include "GSWeb.h"
//#include <gnustep/base/UnixFileHandle.h> //#include <gnustep/base/UnixFileHandle.h>
@ -297,11 +299,11 @@ int allow_severity = LOG_INFO;
NSDebugDeepMLLog(@"ThreadID=%p - A1 readInProgress=%d\n", NSDebugDeepMLLog(@"ThreadID=%p - A1 readInProgress=%d\n",
(void*)objc_thread_id(), (void*)objc_thread_id(),
(int)[_fileHandle readInProgress]); (int)[_fileHandle readInProgress]);
NSDebugDeepMLog(@"NEW CONN APP selfLockn=%d selfLock_thread_id=%p globalLockn=%d globalLock_thread_id=%p threads count=%d waitingThreads count=%d blocked=%d\n", NSDebugDeepMLog(@"NEW CONN APP _selfLockn=%d _selfLock_thread_id=%p _globalLockn=%d _globalLock_thread_id=%p threads count=%d waitingThreads count=%d blocked=%d\n",
(int)([GSWApplication application]->selfLockn), (int)([GSWApplication application]->_selfLockn),
(void*)([GSWApplication application]->selfLock_thread_id), (void*)([GSWApplication application]->_selfLock_thread_id),
(int)([GSWApplication application]->globalLockn), (int)([GSWApplication application]->_globalLockn),
(void*)([GSWApplication application]->globalLock_thread_id), (void*)([GSWApplication application]->_globalLock_thread_id),
[_threads count], [_threads count],
[_waitingThreads count], [_waitingThreads count],
_blocked); _blocked);
@ -481,11 +483,11 @@ int allow_severity = LOG_INFO;
[self unlock]; [self unlock];
}; };
NSDebugLockMLLog(@"trace",@"end announceNewConnection"); NSDebugLockMLLog(@"trace",@"end announceNewConnection");
NSDebugDeepMLog(@"END NEWCONN APP selfLockn=%d selfLock_thread_id=%p globalLockn=%d globalLock_thread_id=%p threads count=%d waitingThreads count=%d blocked=%d acceptOK\n", NSDebugDeepMLog(@"END NEWCONN APP _selfLockn=%d _selfLock_thread_id=%p _globalLockn=%d _globalLock_thread_id=%p threads count=%d waitingThreads count=%d blocked=%d acceptOK\n",
(int)([GSWApplication application]->selfLockn), (int)([GSWApplication application]->_selfLockn),
(void*)([GSWApplication application]->selfLock_thread_id), (void*)([GSWApplication application]->_selfLock_thread_id),
(int)([GSWApplication application]->globalLockn), (int)([GSWApplication application]->_globalLockn),
(void*)([GSWApplication application]->globalLock_thread_id), (void*)([GSWApplication application]->_globalLock_thread_id),
[_threads count], [_threads count],
[_waitingThreads count], [_waitingThreads count],
_blocked); _blocked);
@ -499,11 +501,11 @@ int allow_severity = LOG_INFO;
LOGObjectFnStart(); LOGObjectFnStart();
// NSDebugMLLog(@"trace",@"adaptorThreadExited"); // NSDebugMLLog(@"trace",@"adaptorThreadExited");
NSDebugDeepMLog0(@"adaptorThreadExited\n"); NSDebugDeepMLog0(@"adaptorThreadExited\n");
NSDebugDeepMLog(@"EXIT APP selfLockn=%d selfLock_thread_id=%p globalLockn=%d globalLock_thread_id=%p threads count=%d waitingThreads count=%d blocked=%d\n", NSDebugDeepMLog(@"EXIT APP _selfLockn=%d _selfLock_thread_id=%p _globalLockn=%d _globalLock_thread_id=%p threads count=%d waitingThreads count=%d blocked=%d\n",
(int)([GSWApplication application]->selfLockn), (int)([GSWApplication application]->_selfLockn),
(void*)([GSWApplication application]->selfLock_thread_id), (void*)([GSWApplication application]->_selfLock_thread_id),
(int)([GSWApplication application]->globalLockn), (int)([GSWApplication application]->_globalLockn),
(void*)([GSWApplication application]->globalLock_thread_id), (void*)([GSWApplication application]->_globalLock_thread_id),
[_threads count], [_threads count],
[_waitingThreads count], [_waitingThreads count],
_blocked); _blocked);
@ -513,9 +515,11 @@ int allow_severity = LOG_INFO;
NSAutoreleasePool* pool=nil; NSAutoreleasePool* pool=nil;
#ifndef NDEBUG #ifndef NDEBUG
pool=[NSAutoreleasePool new]; pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
NSDebugLockMLLog(@"low", NSDebugLockMLLog(@"low",
@"remove thread %p", @"remove thread %p",
(void*)adaptorThread); (void*)adaptorThread);
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool); DESTROY(pool);
#endif #endif
NS_DURING NS_DURING
@ -527,9 +531,11 @@ int allow_severity = LOG_INFO;
NS_HANDLER NS_HANDLER
{ {
pool=[NSAutoreleasePool new]; pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
LOGException(@"%@ (%@)", LOGException(@"%@ (%@)",
localException, localException,
[localException reason]); [localException reason]);
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool); DESTROY(pool);
//TODO //TODO
// [self unlock]; // [self unlock];
@ -538,10 +544,12 @@ int allow_severity = LOG_INFO;
NS_ENDHANDLER; NS_ENDHANDLER;
#ifndef NDEBUG #ifndef NDEBUG
pool=[NSAutoreleasePool new]; pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
NSDebugLockMLLog(@"low", NSDebugLockMLLog(@"low",
@"[waitingThreads count]=%d [threads count]=%d", @"[waitingThreads count]=%d [threads count]=%d",
[_waitingThreads count], [_waitingThreads count],
[_threads count]); [_threads count]);
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool); DESTROY(pool);
#endif #endif
if ([_threads count]==0) if ([_threads count]==0)
@ -550,9 +558,11 @@ int allow_severity = LOG_INFO;
if (isApplicationRequestHandlingLocked) if (isApplicationRequestHandlingLocked)
{ {
pool=[NSAutoreleasePool new]; pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
LOGSeriousError0(@"Application RequestHandling is LOCKED !!!"); LOGSeriousError0(@"Application RequestHandling is LOCKED !!!");
NSAssert(NO,@"Application RequestHandling is LOCKED !!!");//TODO-NOW NSAssert(NO,@"Application RequestHandling is LOCKED !!!");//TODO-NOW
[[GSWApplication application] terminate]; [[GSWApplication application] terminate];
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool); DESTROY(pool);
}; };
}; };
@ -577,10 +587,12 @@ int allow_severity = LOG_INFO;
{ {
#ifndef NDEBUG #ifndef NDEBUG
pool=[NSAutoreleasePool new]; pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
[GSWApplication statusLogWithFormat:@"Lauch waiting Thread"]; [GSWApplication statusLogWithFormat:@"Lauch waiting Thread"];
NSDebugLockMLLog(@"info", NSDebugLockMLLog(@"info",
@"Lauch waiting Thread %p", @"Lauch waiting Thread %p",
(void*)thread); (void*)thread);
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool); DESTROY(pool);
#endif #endif
if (_isMultiThreadEnabled) if (_isMultiThreadEnabled)
@ -594,9 +606,11 @@ int allow_severity = LOG_INFO;
NS_HANDLER NS_HANDLER
{ {
pool=[NSAutoreleasePool new]; pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
LOGException(@"%@ (%@)", LOGException(@"%@ (%@)",
localException, localException,
[localException reason]); [localException reason]);
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool); DESTROY(pool);
//TODO //TODO
// [self unlock]; // [self unlock];
@ -619,9 +633,11 @@ int allow_severity = LOG_INFO;
NS_HANDLER NS_HANDLER
{ {
pool=[NSAutoreleasePool new]; pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
LOGException(@"%@ (%@)", LOGException(@"%@ (%@)",
localException, localException,
[localException reason]); [localException reason]);
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool); DESTROY(pool);
//TODO //TODO
// [self unlock]; // [self unlock];
@ -631,11 +647,11 @@ int allow_severity = LOG_INFO;
[self unlock]; [self unlock];
}; };
NSDebugDeepMLog(@"END EXIT APP selfLockn=%d selfLock_thread_id=%p globalLockn=%d globalLock_thread_id=%p threads count=%d waitingThreads count=%d blocked=%d\n", NSDebugDeepMLog(@"END EXIT APP _selfLockn=%d _selfLock_thread_id=%p _globalLockn=%d _globalLock_thread_id=%p threads count=%d waitingThreads count=%d blocked=%d\n",
(int)([GSWApplication application]->selfLockn), (int)([GSWApplication application]->_selfLockn),
(void*)([GSWApplication application]->selfLock_thread_id), (void*)([GSWApplication application]->_selfLock_thread_id),
(int)([GSWApplication application]->globalLockn), (int)([GSWApplication application]->_globalLockn),
(void*)([GSWApplication application]->globalLock_thread_id), (void*)([GSWApplication application]->_globalLock_thread_id),
[_threads count], [_threads count],
[_waitingThreads count], [_waitingThreads count],
_blocked); _blocked);

View file

@ -1,4 +1,5 @@
/** GSWDefaultAdaptorThread.m - <title>GSWeb: Class GSWDefaultAdaptorThread</title> /** GSWDefaultAdaptorThread.m - <title>GSWeb: Class GSWDefaultAdaptorThread</title>
Copyright (C) 1999-2003 Free Software Foundation, Inc. Copyright (C) 1999-2003 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
@ -105,6 +106,7 @@ static const char rcsId[] = "$Id$";
if (destroy) if (destroy)
{ {
GSWLogMemC("dealloc pool\n"); GSWLogMemC("dealloc pool\n");
GSWLogMemCF("Destroy NSAutoreleasePool: %p. ThreadID=%p",_pool,(void*)objc_thread_id());
DESTROY(_pool); DESTROY(_pool);
GSWLogMemC("end dealloc pool\n"); GSWLogMemC("end dealloc pool\n");
}; };
@ -126,6 +128,7 @@ static const char rcsId[] = "$Id$";
[GSWApplication statusLogWithFormat:@"Thread run START"]; [GSWApplication statusLogWithFormat:@"Thread run START"];
#endif #endif
_pool=[NSAutoreleasePool new]; _pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",_pool);
#ifdef GSWDEBUG_DEEP #ifdef GSWDEBUG_DEEP
[GSWApplication logWithFormat:@"pool allocated!"]; [GSWApplication logWithFormat:@"pool allocated!"];
#endif #endif
@ -263,6 +266,7 @@ static const char rcsId[] = "$Id$";
// NSDebugMLLog(@"low",@"[_defaultAdaptorThread retainCount=%d", // NSDebugMLLog(@"low",@"[_defaultAdaptorThread retainCount=%d",
// (int)[self retainCount]); // (int)[self retainCount]);
[_adaptor adaptorThreadExited:self]; [_adaptor adaptorThreadExited:self];
GSWLogMemCF("Will Destroy NSAutoreleasePool: %p",_pool);
[self setPool:nil [self setPool:nil
destroyLast:YES]; destroyLast:YES];
// LOGObjectFnStop(); // LOGObjectFnStop();
@ -594,13 +598,12 @@ static const char rcsId[] = "$Id$";
/* if (isHeaderKeysEqual(method,GSWHTTPHeader_MethodPost)) /* if (isHeaderKeysEqual(method,GSWHTTPHeader_MethodPost))
{ {
*/ */
request=[[[GSWRequest alloc] initWithMethod:method request=[_application createRequestWithMethod:method
uri:url uri:url
httpVersion:httpVersion httpVersion:httpVersion
headers:headers headers:headers
content:data content:data
userInfo:nil] userInfo:nil];
autorelease];
/* };*/ /* };*/
}; };
}; };
@ -805,6 +808,7 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
GSWResponse* response=nil; GSWResponse* response=nil;
NSAutoreleasePool* pool=nil; NSAutoreleasePool* pool=nil;
pool=[NSAutoreleasePool new]; pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
LOGDEEPClassFnStart(); LOGDEEPClassFnStart();
response=[GSWResponse responseWithMessage:@"Temporary unavailable" response=[GSWResponse responseWithMessage:@"Temporary unavailable"
inContext:nil inContext:nil
@ -818,6 +822,7 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
withAdditionalHeaderLines:nil withAdditionalHeaderLines:nil
withRemoteAddress:nil]; withRemoteAddress:nil];
LOGDEEPClassFnStop(); LOGDEEPClassFnStop();
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool); DESTROY(pool);
}; };
@ -827,6 +832,7 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
GSWResponse* response=nil; GSWResponse* response=nil;
NSAutoreleasePool* pool=nil; NSAutoreleasePool* pool=nil;
pool=[NSAutoreleasePool new]; pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
LOGDEEPClassFnStart(); LOGDEEPClassFnStart();
response=[GSWResponse responseWithMessage:message response=[GSWResponse responseWithMessage:message
inContext:nil inContext:nil
@ -840,6 +846,7 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
withAdditionalHeaderLines:nil withAdditionalHeaderLines:nil
withRemoteAddress:nil]; withRemoteAddress:nil];
LOGDEEPClassFnStop(); LOGDEEPClassFnStop();
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool); DESTROY(pool);
}; };

View file

@ -1,12 +1,13 @@
/** GSWDirectActionRequestHandler.m - <title>GSWeb: Class GSWDirectActionRequestHandler</title> /** GSWDirectActionRequestHandler.m - <title>GSWeb: Class GSWDirectActionRequestHandler</title>
Copyright (C) 1999-2002 Free Software Foundation, Inc. Copyright (C) 1999-2003 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Feb 1999 Date: Feb 1999
$Revision$ $Revision$
$Date$ $Date$
$Id$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
@ -27,7 +28,7 @@
</license> </license>
**/ **/
static char rcsId[] = "$Id$"; static const char rcsId[] = "$Id$";
#include "GSWeb.h" #include "GSWeb.h"
@ -181,7 +182,7 @@ static char rcsId[] = "$Id$";
//OK //OK
GSWResponse* response=nil; GSWResponse* response=nil;
LOGObjectFnStart(); LOGObjectFnStart();
response=[[GSWResponse new]autorelease]; response=[GSWApp createResponseInContext:nil];
[response appendContentString:@"<HTML><HEAD><TITLE>DirectAction Error</TITLE></HEAD><BODY>The result of a direct action returned nothing.</BODY></HTML>"]; [response appendContentString:@"<HTML><HEAD><TITLE>DirectAction Error</TITLE></HEAD><BODY>The result of a direct action returned nothing.</BODY></HTML>"];
LOGObjectFnStop(); LOGObjectFnStop();
return response; return response;

View file

@ -31,7 +31,7 @@
static const char rcsId[] = "$Id$"; static const char rcsId[] = "$Id$";
#include "GSWeb.h" #include "GSWeb.h"
#include <gscrypt/GSMD5.h> #include <gnustep/base/GSCategories.h>
//==================================================================== //====================================================================
@implementation GSWHTMLURLValuedElement @implementation GSWHTMLURLValuedElement
@ -271,6 +271,7 @@ static const char rcsId[] = "$Id$";
return element; return element;
}; };
@end
//==================================================================== //====================================================================
@implementation GSWHTMLURLValuedElement (GSWHTMLURLValuedElementB) @implementation GSWHTMLURLValuedElement (GSWHTMLURLValuedElementB)
@ -575,10 +576,10 @@ NS_DURING
NSDebugMLLog(@"gswdync",@"cidKeyValue=%@",cidKeyValue); NSDebugMLLog(@"gswdync",@"cidKeyValue=%@",cidKeyValue);
if (!cidKeyValue) if (!cidKeyValue)
{ {
// We calculate cidKeyValue by computing md5 on path // We calculate cidKeyValue by computing md5 on url
// so there will be no duplicate elements with different keys // so there will be no duplicate elements with different keys
cidKeyValue=DataToHexString([GSMD5 digestOfString:url NSData* data = [url dataUsingEncoding: NSISOLatin1StringEncoding];
usingEncoding:NSISOLatin1StringEncoding]); cidKeyValue=[[data md5Digest] hexadecimalRepresentation];
}; };
newURL=[self addCIDElement:[NSDictionary dictionaryWithObject:url newURL=[self addCIDElement:[NSDictionary dictionaryWithObject:url
forKey:@"url"] forKey:@"url"]
@ -608,7 +609,7 @@ NS_DURING
{ {
// We calculate cidKeyValue by computing md5 on path // We calculate cidKeyValue by computing md5 on path
// so there will be no duplicate elements with different keys // so there will be no duplicate elements with different keys
//NSString* cidKeyValue=DataToHexString([GSMD5 digestOfData:data]); //NSString* cidKeyValue=[[data md5Digest] hexadecimalRepresentation];
cidKeyValue=[data key]; cidKeyValue=[data key];
}; };
newURL=[self addCIDElement:[NSDictionary dictionaryWithObject:data newURL=[self addCIDElement:[NSDictionary dictionaryWithObject:data
@ -639,8 +640,8 @@ NS_DURING
{ {
// We calculate cidKeyValue by computing md5 on path // We calculate cidKeyValue by computing md5 on path
// so there will be no duplicate elements with different keys // so there will be no duplicate elements with different keys
cidKeyValue=DataToHexString([GSMD5 digestOfString:path NSData* data = [path dataUsingEncoding: NSISOLatin1StringEncoding];
usingEncoding:NSISOLatin1StringEncoding]); cidKeyValue=[[data md5Digest] hexadecimalRepresentation];
}; };
newURL=[self addCIDElement:[NSDictionary dictionaryWithObject:path newURL=[self addCIDElement:[NSDictionary dictionaryWithObject:path

View file

@ -1,12 +1,13 @@
/** GSWResourceRequestHandler.m - <title>GSWeb: Class GSWResourceRequestHandler</title> /** GSWResourceRequestHandler.m - <title>GSWeb: Class GSWResourceRequestHandler</title>
Copyright (C) 1999-2002 Free Software Foundation, Inc. Copyright (C) 1999-2003 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Feb 1999 Date: Feb 1999
$Revision$ $Revision$
$Date$ $Date$
$Id$
This file is part of the GNUstep Web Library. This file is part of the GNUstep Web Library.
@ -27,7 +28,7 @@
</license> </license>
**/ **/
static char rcsId[] = "$Id$"; static const char rcsId[] = "$Id$";
#include "GSWeb.h" #include "GSWeb.h"
@ -83,7 +84,7 @@ static char rcsId[] = "$Id$";
GSWURLValuedElementData* data=nil; GSWURLValuedElementData* data=nil;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLog(@"aKey=%@",aKey); NSDebugMLog(@"aKey=%@",aKey);
response=[[GSWResponse new]autorelease]; response=[GSWApp createResponseInContext:nil];
resourceManager=[[GSWApplication application] resourceManager]; resourceManager=[[GSWApplication application] resourceManager];
data=[resourceManager _cachedDataForKey:aKey]; data=[resourceManager _cachedDataForKey:aKey];
NSDebugMLog(@"data=%@",data); NSDebugMLog(@"data=%@",data);

View file

@ -366,8 +366,11 @@ static NSArray* cacheControlHeaderValues=nil;
length:(unsigned)length length:(unsigned)length
{ {
LOGObjectFnStart(); LOGObjectFnStart();
[_contentData appendBytes:bytes if (length>0)
length:length]; {
[_contentData appendBytes:bytes
length:length];
};
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -377,8 +380,8 @@ static NSArray* cacheControlHeaderValues=nil;
-(void)appendContentCharacter:(char)aChar -(void)appendContentCharacter:(char)aChar
{ {
LOGObjectFnStart(); LOGObjectFnStart();
[_contentData appendBytes:&aChar [self appendContentBytes:&aChar
length:1]; length:1];
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -387,9 +390,14 @@ static NSArray* cacheControlHeaderValues=nil;
-(void)appendContentData:(NSData*)dataObject -(void)appendContentData:(NSData*)dataObject
{ {
unsigned char* bytes=NULL;
unsigned int length=0;
LOGObjectFnStart(); LOGObjectFnStart();
NSDebugMLLog(@"low",@"response=%p dataObject:%@",self,dataObject); NSDebugMLLog(@"low",@"response=%p dataObject:%@",self,dataObject);
[_contentData appendData:dataObject]; bytes=[dataObject bytes];
length=[dataObject length];
[self appendContentBytes:bytes
length:length];
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -687,7 +695,7 @@ static NSArray* cacheControlHeaderValues=nil;
string=[NSString stringWithObject:aString]; string=[NSString stringWithObject:aString];
NSDebugMLLog(@"low",@"_string:%@",string); NSDebugMLLog(@"low",@"_string:%@",string);
newData=[string dataUsingEncoding:_contentEncoding]; newData=[string dataUsingEncoding:_contentEncoding];
[_contentData appendData:newData]; [self appendContentData:newData];
LOGObjectFnStop(); LOGObjectFnStop();
}; };
@ -803,7 +811,7 @@ escapingHTMLAttributeValue:(BOOL)escape
GSWResponse* response=nil; GSWResponse* response=nil;
NSString* httpVersion=nil; NSString* httpVersion=nil;
LOGClassFnStart(); LOGClassFnStart();
response=[[self new]autorelease]; response=[GSWApp createResponseInContext:aContext];
if (response) if (response)
{ {
NSString* responseString=nil; NSString* responseString=nil;
@ -839,7 +847,7 @@ escapingHTMLAttributeValue:(BOOL)escape
GSWResponse* response=nil; GSWResponse* response=nil;
NSString* httpVersion=nil; NSString* httpVersion=nil;
LOGClassFnStart(); LOGClassFnStart();
response=[[self new]autorelease]; response=[GSWApp createResponseInContext:aContext];
if (response) if (response)
{ {
NSString* responseString=nil; NSString* responseString=nil;
@ -921,7 +929,7 @@ escapingHTMLAttributeValue:(BOOL)escape
GSWResponse* response=nil; GSWResponse* response=nil;
NSString* httpVersion=nil; NSString* httpVersion=nil;
LOGClassFnStart(); LOGClassFnStart();
response=[[self new]autorelease]; response=[GSWApp createResponseInContext:aContext];
if (response) if (response)
{ {
if (aContext && [aContext request]) if (aContext && [aContext request])

View file

@ -31,7 +31,8 @@
static const char rcsId[] = "$Id$"; static const char rcsId[] = "$Id$";
#include "GSWeb.h" #include "GSWeb.h"
#include <gscrypt/GSMD5.h> #include <gnustep/base/GSCategories.h>
#include <time.h> #include <time.h>
#if __linux__ #if __linux__
#include <linux/kernel.h> #include <linux/kernel.h>
@ -39,12 +40,6 @@ static const char rcsId[] = "$Id$";
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#endif #endif
/*
#ifdef NOEXTENSIONS
#else
#include <extensions/GarbageCollector.h>
#endif
*/
//==================================================================== //====================================================================
@implementation GSWSession @implementation GSWSession
@ -125,7 +120,7 @@ static const char rcsId[] = "$Id$";
if (sizeToFill>=sizeof(unsigned int) && info.uptime>0) if (sizeToFill>=sizeof(unsigned int) && info.uptime>0)
{ {
rnd=(unsigned)(UINT_MAX*rand()/(RAND_MAX+1.0)); rnd=(unsigned)(((float)UINT_MAX)*rand()/(RAND_MAX+1.0));
NSDebugMLog(@"UPTIME %ld",(long)info.uptime); NSDebugMLog(@"UPTIME %ld",(long)info.uptime);
*((unsigned int*)pMd5Data)=(((unsigned int)(info.uptime)) ^ rnd); *((unsigned int*)pMd5Data)=(((unsigned int)(info.uptime)) ^ rnd);
sizeToFill-=sizeof(unsigned int); sizeToFill-=sizeof(unsigned int);
@ -134,7 +129,7 @@ static const char rcsId[] = "$Id$";
if (sizeToFill>=sizeof(unsigned int) && info.loads[0]>0) if (sizeToFill>=sizeof(unsigned int) && info.loads[0]>0)
{ {
rnd=(unsigned)(UINT_MAX*rand()/(RAND_MAX+1.0)); rnd=(unsigned)(((float)UINT_MAX)*rand()/(RAND_MAX+1.0));
NSDebugMLog(@"loads[0] %ld",(long)info.loads[0]); NSDebugMLog(@"loads[0] %ld",(long)info.loads[0]);
*((unsigned int*)pMd5Data)=(((unsigned int)(info.loads[0] >> 4)) ^ rnd); *((unsigned int*)pMd5Data)=(((unsigned int)(info.loads[0] >> 4)) ^ rnd);
sizeToFill-=sizeof(unsigned int); sizeToFill-=sizeof(unsigned int);
@ -143,7 +138,7 @@ static const char rcsId[] = "$Id$";
if (sizeToFill>=sizeof(unsigned int) && info.loads[1]>0) if (sizeToFill>=sizeof(unsigned int) && info.loads[1]>0)
{ {
rnd=(unsigned)(UINT_MAX*rand()/(RAND_MAX+1.0)); rnd=(unsigned)(((float)UINT_MAX)*rand()/(RAND_MAX+1.0));
NSDebugMLog(@"loads[1] %ld",(long)info.loads[1]); NSDebugMLog(@"loads[1] %ld",(long)info.loads[1]);
*((unsigned int*)pMd5Data)=(((unsigned int)(info.loads[1] >> 4)) ^ rnd); *((unsigned int*)pMd5Data)=(((unsigned int)(info.loads[1] >> 4)) ^ rnd);
sizeToFill-=sizeof(unsigned int); sizeToFill-=sizeof(unsigned int);
@ -152,7 +147,7 @@ static const char rcsId[] = "$Id$";
if (sizeToFill>=sizeof(unsigned int) && info.loads[2]>0) if (sizeToFill>=sizeof(unsigned int) && info.loads[2]>0)
{ {
rnd=(unsigned)(UINT_MAX*rand()/(RAND_MAX+1.0)); rnd=(unsigned)(((float)UINT_MAX)*rand()/(RAND_MAX+1.0));
NSDebugMLog(@"loads[2] %ld",(long)info.loads[2]); NSDebugMLog(@"loads[2] %ld",(long)info.loads[2]);
*((unsigned int*)pMd5Data)=(((unsigned int)(info.loads[2] >> 4)) ^ rnd); *((unsigned int*)pMd5Data)=(((unsigned int)(info.loads[2] >> 4)) ^ rnd);
sizeToFill-=sizeof(unsigned int); sizeToFill-=sizeof(unsigned int);
@ -162,7 +157,7 @@ static const char rcsId[] = "$Id$";
if (sizeToFill>=sizeof(unsigned int) && info.freeram>0) if (sizeToFill>=sizeof(unsigned int) && info.freeram>0)
{ {
NSDebugMLog(@"freeram %ld",(unsigned long)info.freeram); NSDebugMLog(@"freeram %ld",(unsigned long)info.freeram);
rnd=(unsigned)(UINT_MAX*rand()/(RAND_MAX+1.0)); rnd=(unsigned)(((float)UINT_MAX)*rand()/(RAND_MAX+1.0));
*((unsigned int*)pMd5Data)=(((unsigned int)(info.freeram >> 4)) ^ rnd); // Drop 4 minor bits *((unsigned int*)pMd5Data)=(((unsigned int)(info.freeram >> 4)) ^ rnd); // Drop 4 minor bits
sizeToFill-=sizeof(unsigned int); sizeToFill-=sizeof(unsigned int);
pMd5Data+=sizeof(unsigned int); pMd5Data+=sizeof(unsigned int);
@ -171,7 +166,7 @@ static const char rcsId[] = "$Id$";
if (sizeToFill>=sizeof(unsigned int) && info.sharedram>0) if (sizeToFill>=sizeof(unsigned int) && info.sharedram>0)
{ {
NSDebugMLog(@"sharedram %ld",(unsigned long)info.sharedram); NSDebugMLog(@"sharedram %ld",(unsigned long)info.sharedram);
rnd=(unsigned)(UINT_MAX*rand()/(RAND_MAX+1.0)); rnd=(unsigned)(((float)UINT_MAX)*rand()/(RAND_MAX+1.0));
*((unsigned int*)pMd5Data)=(((unsigned int)(info.sharedram >> 4)) ^ rnd); // Drop 4 minor bits *((unsigned int*)pMd5Data)=(((unsigned int)(info.sharedram >> 4)) ^ rnd); // Drop 4 minor bits
sizeToFill-=sizeof(unsigned int); sizeToFill-=sizeof(unsigned int);
pMd5Data+=sizeof(unsigned int); pMd5Data+=sizeof(unsigned int);
@ -180,7 +175,7 @@ static const char rcsId[] = "$Id$";
if (sizeToFill>=sizeof(unsigned int) && info.freeswap>0) if (sizeToFill>=sizeof(unsigned int) && info.freeswap>0)
{ {
NSDebugMLog(@"freeswap %ld",(unsigned long)info.freeswap); NSDebugMLog(@"freeswap %ld",(unsigned long)info.freeswap);
rnd=(unsigned)(UINT_MAX*rand()/(RAND_MAX+1.0)); rnd=(unsigned)(((float)UINT_MAX)*rand()/(RAND_MAX+1.0));
*((unsigned int*)pMd5Data)=(((unsigned int)(info.freeswap >> 4)) ^ rnd); // Drop 4 minor bits *((unsigned int*)pMd5Data)=(((unsigned int)(info.freeswap >> 4)) ^ rnd); // Drop 4 minor bits
sizeToFill-=sizeof(unsigned int); sizeToFill-=sizeof(unsigned int);
pMd5Data+=sizeof(unsigned int); pMd5Data+=sizeof(unsigned int);
@ -189,7 +184,7 @@ static const char rcsId[] = "$Id$";
if (sizeToFill>=sizeof(unsigned int) && info.bufferram>0) if (sizeToFill>=sizeof(unsigned int) && info.bufferram>0)
{ {
NSDebugMLog(@"bufferram %ld",(unsigned long)info.bufferram); NSDebugMLog(@"bufferram %ld",(unsigned long)info.bufferram);
rnd=(unsigned)(UINT_MAX*rand()/(RAND_MAX+1.0)); rnd=(unsigned)(((float)UINT_MAX)*rand()/(RAND_MAX+1.0));
*((unsigned int*)pMd5Data)=(((unsigned int)(info.bufferram >> 4)) ^ rnd); // Drop 4 minor bits *((unsigned int*)pMd5Data)=(((unsigned int)(info.bufferram >> 4)) ^ rnd); // Drop 4 minor bits
sizeToFill-=sizeof(unsigned int); sizeToFill-=sizeof(unsigned int);
pMd5Data+=sizeof(unsigned int); pMd5Data+=sizeof(unsigned int);
@ -200,14 +195,14 @@ static const char rcsId[] = "$Id$";
NSDebugMLog(@"sizeToFill %d",sizeToFill); NSDebugMLog(@"sizeToFill %d",sizeToFill);
while(sizeToFill>0) while(sizeToFill>0)
{ {
*((unsigned char*)pMd5Data)=(unsigned char)(256*rand()/(RAND_MAX+1.0)); *((unsigned char*)pMd5Data)=(unsigned char)(256.0*rand()/(RAND_MAX+1.0));
sizeToFill--; sizeToFill--;
pMd5Data++; pMd5Data++;
}; };
//Now do md5 on bytes after sizeof(ts) //Now do md5 on bytes after sizeof(ts)
md5Sum=[GSMD5 digestOfData:md5Data]; md5Sum=[md5Data md5Digest];
[data appendData:md5Sum]; [data appendData:md5Sum];
sessionID=DataToHexString(data); sessionID=[data hexadecimalRepresentation];
return sessionID; return sessionID;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -243,10 +238,11 @@ static const char rcsId[] = "$Id$";
-(void)dealloc -(void)dealloc
{ {
GSWLogAssertGood(self); GSWLogAssertGood(self);
NSDebugFLog0(@"Dealloc GSWSession"); NSDebugFLog(@"Dealloc GSWSession %p. ThreadID=%p",(void*)self,(void*)objc_thread_id());
NSDebugFLog0(@"Dealloc GSWSession: sessionID"); NSDebugFLog0(@"Dealloc GSWSession: sessionID");
DESTROY(_sessionID); DESTROY(_sessionID);
NSDebugFLog0(@"Dealloc GSWSession:autoreleasePool "); NSDebugFLog0(@"Dealloc GSWSession:autoreleasePool ");
GSWLogMemCF("Destroy NSAutoreleasePool: %p. ThreadID=%p",_autoreleasePool,(void*)objc_thread_id());
DESTROY(_autoreleasePool); DESTROY(_autoreleasePool);
NSDebugFLog0(@"Dealloc GSWSession: contextArrayStack"); NSDebugFLog0(@"Dealloc GSWSession: contextArrayStack");
DESTROY(_contextArrayStack); DESTROY(_contextArrayStack);
@ -794,7 +790,10 @@ fprintf(stderr,"session %p _releaseAutoreleasePool STOP\n",self);
//OK //OK
LOGObjectFnStart(); LOGObjectFnStart();
if (!_autoreleasePool) if (!_autoreleasePool)
_autoreleasePool=[NSAutoreleasePool new]; {
_autoreleasePool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",_autoreleasePool);
}
LOGObjectFnStop(); LOGObjectFnStop();
}; };

View file

@ -1,6 +1,6 @@
/** GSWTemplateParser.m - <title>GSWeb: Class GSWTemplateParser</title> /** GSWTemplateParser.m - <title>GSWeb: Class GSWTemplateParser</title>
Copyright (C) 1999-2002 Free Software Foundation, Inc. Copyright (C) 1999-2003 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com> Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 1999 Date: Mar 1999
@ -30,6 +30,8 @@
</license> </license>
**/ **/
static const char rcsId[]="$Id$";
#include "GSWeb.h" #include "GSWeb.h"
#include <gsantlr/ANTLRCommon.h> #include <gsantlr/ANTLRCommon.h>
@ -401,6 +403,7 @@
GSWPageDefParser* definitionsParser=nil; GSWPageDefParser* definitionsParser=nil;
LOGObjectFnStart(); LOGObjectFnStart();
arpParse=[NSAutoreleasePool new]; arpParse=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",arpParse);
definitionsStream=[[ANTLRTextInputStreamString newWithString:aLocalDefinitionString] definitionsStream=[[ANTLRTextInputStreamString newWithString:aLocalDefinitionString]
autorelease]; autorelease];
definitionsLexer=[[[GSWPageDefLexer alloc]initWithTextStream:definitionsStream] definitionsLexer=[[[GSWPageDefLexer alloc]initWithTextStream:definitionsStream]
@ -444,6 +447,7 @@
@"%@ In [definitionsParser document]...", @"%@ In [definitionsParser document]...",
[self logPrefix]); [self logPrefix]);
[localException retain]; [localException retain];
GSWLogMemCF("Destroy NSAutoreleasePool: %p",arpParse);
DESTROY(arpParse); DESTROY(arpParse);
[localException autorelease]; [localException autorelease];
[localException raise]; [localException raise];
@ -453,6 +457,7 @@
[tmpDefinitions retain]; [tmpDefinitions retain];
[definitionsIncludes retain]; [definitionsIncludes retain];
NSDebugMLLog0(@"low",@"DESTROY(arpParse)\n"); NSDebugMLLog0(@"low",@"DESTROY(arpParse)\n");
GSWLogMemCF("Destroy NSAutoreleasePool: %p",arpParse);
DESTROY(arpParse); DESTROY(arpParse);
NSDebugMLLog0(@"low",@"DESTROYED(arpParse)\n"); NSDebugMLLog0(@"low",@"DESTROYED(arpParse)\n");
[tmpDefinitions autorelease]; [tmpDefinitions autorelease];

View file

@ -897,250 +897,269 @@ text [Type:XML_TEXT_NODE] [{}] ####
includesComment=[GSWApplication includeCommentsInResponses]; includesComment=[GSWApplication includeCommentsInResponses];
_elements=[NSMutableArray array]; _elements=[NSMutableArray array];
arp=[NSAutoreleasePool new]; arp=[NSAutoreleasePool new];
while(currentNode) GSWLogMemCF("New NSAutoreleasePool: %p",arp);
NS_DURING
{ {
GSWElement* elem=nil; while(currentNode)
NSDebugMLLog(@"GSWTemplateParser",@"BEGIN node=%p %@ [Type:%@] [%@] ##%s##\n",
currentNode,
[currentNode name],
[currentNode typeDescription],
[currentNode propertiesAsDictionaryWithKeyTransformationSel:NULL],
/* ((xmlNodePtr)[currentNode lib])->content,
[currentNode content],*/
[[currentNode content] lossyCString]);
switch([currentNode type])
{ {
case XML_TEXT_NODE: GSWElement* elem=nil;
{ NSDebugMLLog(@"GSWTemplateParser",@"BEGIN node=%p %@ [Type:%@] [%@] ##%s##\n",
NSDebugMLog0(@"TEXT"); currentNode,
[currentNode name],
[currentNode typeDescription],
[currentNode propertiesAsDictionaryWithKeyTransformationSel:NULL],
/* ((xmlNodePtr)[currentNode lib])->content,
[currentNode content],*/
[[currentNode content] lossyCString]);
if ([currentNode content] && ([[currentNode content] length] > 0) ) { switch([currentNode type])
elem=[GSWHTMLBareString elementWithString:
[NSString stringWithCString:
[[[currentNode content]
stringByConvertingToHTMLEntities]
lossyCString]]];//Because XML Parser decode characters
} else {
elem = nil;
}
NSDebugMLLog(@"GSWTemplateParser",@"TEXT element=%@",elem);
};
break;
case XML_CDATA_SECTION_NODE:
{
NSDebugMLog0(@"CDATA_SECTION");
NSDebugMLLog(@"GSWTemplateParser",@"CDATA_SECTION content=%s",[[currentNode content] lossyCString]);
elem=[GSWHTMLBareString elementWithString:[currentNode content]];
NSDebugMLLog(@"GSWTemplateParser",@"CDATA_SECTION element=%@",elem);
};
break;
case XML_COMMENT_NODE:
{
NSDebugMLog0(@"COMMENT");
if (includesComment)
{
elem=[GSWHTMLBareString elementWithString:[NSString stringWithFormat:@"<!-- %s -->",[[currentNode content] lossyCString]]];
NSDebugMLLog(@"GSWTemplateParser",@"COMMENT element=%@",elem);
};
};
break;
default:
{
int currentGSWebTagN=0;
int currentTagN=0;
NSArray* children=nil;
NSDictionary* nodeAttributes=nil;
NSString* nodeName=nil;
NSString* nodeNameAttribute=nil;
nodeName=[currentNode name];
NSDebugMLLog(@"GSWTemplateParser",@"DEFAULT (name=%@ type=%@)",nodeName,[currentNode typeDescription]);
//if (currentNode->type==XML_ELEMENT_NODE)
{ {
nodeAttributes=[currentNode propertiesAsDictionaryWithKeyTransformationSel:@selector(lowercaseString)]; case XML_TEXT_NODE:
nodeNameAttribute=[nodeAttributes objectForKey:@"name"]; {
NSDebugMLLog(@"GSWTemplateParser",@"node=%p nodeAttributes=%@",currentNode,nodeAttributes); NSDebugMLog0(@"TEXT");
NSDebugMLLog(@"GSWTemplateParser",@"node=%p nodeNameAttribute=%@",currentNode,nodeNameAttribute);
tagN++; if ([currentNode content] && ([[currentNode content] length] > 0) ) {
if ([nodeName caseInsensitiveCompare:GSWTag_Name[GSWNAMES_INDEX]]==NSOrderedSame
||[nodeName caseInsensitiveCompare:GSWTag_Name[WONAMES_INDEX]]==NSOrderedSame) elem=[GSWHTMLBareString elementWithString:
gswebTagN++; [NSString stringWithCString:
currentGSWebTagN=gswebTagN; [[[currentNode content]
currentTagN=tagN; stringByConvertingToHTMLEntities]
if ([currentNode firstChild]) lossyCString]]];//Because XML Parser decode characters
} else {
elem = nil;
}
NSDebugMLLog(@"GSWTemplateParser",@"TEXT element=%@",elem);
};
break;
case XML_CDATA_SECTION_NODE:
{
NSDebugMLog0(@"CDATA_SECTION");
NSDebugMLLog(@"GSWTemplateParser",@"CDATA_SECTION content=%s",[[currentNode content] lossyCString]);
elem=[GSWHTMLBareString elementWithString:[currentNode content]];
NSDebugMLLog(@"GSWTemplateParser",@"CDATA_SECTION element=%@",elem);
};
break;
case XML_COMMENT_NODE:
{
NSDebugMLog0(@"COMMENT");
if (includesComment)
{
elem=[GSWHTMLBareString elementWithString:[NSString stringWithFormat:@"<!-- %s -->",[[currentNode content] lossyCString]]];
NSDebugMLLog(@"GSWTemplateParser",@"COMMENT element=%@",elem);
};
};
break;
default:
{
int currentGSWebTagN=0;
int currentTagN=0;
NSArray* children=nil;
NSDictionary* nodeAttributes=nil;
NSString* nodeName=nil;
NSString* nodeNameAttribute=nil;
nodeName=[currentNode name];
NSDebugMLLog(@"GSWTemplateParser",@"DEFAULT (name=%@ type=%@)",nodeName,[currentNode typeDescription]);
//if (currentNode->type==XML_ELEMENT_NODE)
{ {
children=[self createElementsFromNode:[currentNode firstChild]]; nodeAttributes=[currentNode propertiesAsDictionaryWithKeyTransformationSel:@selector(lowercaseString)];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p children=%@",currentNode,children); nodeNameAttribute=[nodeAttributes objectForKey:@"name"];
}; NSDebugMLLog(@"GSWTemplateParser",@"node=%p nodeAttributes=%@",currentNode,nodeAttributes);
if ([nodeName caseInsensitiveCompare:GSWTag_Name[GSWNAMES_INDEX]]==NSOrderedSame NSDebugMLLog(@"GSWTemplateParser",@"node=%p nodeNameAttribute=%@",currentNode,nodeNameAttribute);
||[nodeName caseInsensitiveCompare:GSWTag_Name[WONAMES_INDEX]]==NSOrderedSame) tagN++;
{ if ([nodeName caseInsensitiveCompare:GSWTag_Name[GSWNAMES_INDEX]]==NSOrderedSame
GSWPageDefElement* definitionsElement=nil; ||[nodeName caseInsensitiveCompare:GSWTag_Name[WONAMES_INDEX]]==NSOrderedSame)
if (!nodeNameAttribute) gswebTagN++;
currentGSWebTagN=gswebTagN;
currentTagN=tagN;
if ([currentNode firstChild])
{ {
// allow null name tags children=[self createElementsFromNode:[currentNode firstChild]];
elem=[[[GSWHTMLStaticGroup alloc]initWithContentElements:children]autorelease]; NSDebugMLLog(@"GSWTemplateParser",@"node=%p children=%@",currentNode,children);
} };
else if ([nodeName caseInsensitiveCompare:GSWTag_Name[GSWNAMES_INDEX]]==NSOrderedSame
||[nodeName caseInsensitiveCompare:GSWTag_Name[WONAMES_INDEX]]==NSOrderedSame)
{ {
NSDictionary* _associations=nil; GSWPageDefElement* definitionsElement=nil;
NSString* className=nil; if (!nodeNameAttribute)
GSWHTMLStaticGroup* aStaticGroup=nil;
definitionsElement=[_definitions objectForKey:nodeNameAttribute];
NSDebugMLLog(@"GSWTemplateParser",@"definitionsElement:[%@]",
definitionsElement);
NSDebugMLLog(@"GSWTemplateParser",@"GSWeb Tag definitionsElement:[%@]",
definitionsElement);
if (!definitionsElement)
{ {
// We don't raise exception know because it's better for developper to collect and report all errors before :-) // allow null name tags
[self addErrorMessageFormat:@"No element definition for tag named:%@ [#%d,#%d]", elem=[[[GSWHTMLStaticGroup alloc]initWithContentElements:children]autorelease];
nodeNameAttribute,
currentGSWebTagN,
currentTagN];
} }
else else
{ {
_associations=[definitionsElement associations]; NSDictionary* _associations=nil;
className=[definitionsElement className]; NSString* className=nil;
NSDebugMLLog(@"GSWTemplateParser",@"node=%p GSWeb Tag className:[%@]",currentNode,className); GSWHTMLStaticGroup* aStaticGroup=nil;
if (!className) definitionsElement=[_definitions objectForKey:nodeNameAttribute];
NSDebugMLLog(@"GSWTemplateParser",@"definitionsElement:[%@]",
definitionsElement);
NSDebugMLLog(@"GSWTemplateParser",@"GSWeb Tag definitionsElement:[%@]",
definitionsElement);
if (!definitionsElement)
{ {
// We don't raise exception know because it's better for developper to collect and report all errors before :-) // We don't raise exception know because it's better for developper to collect and report all errors before :-)
[self addErrorMessageFormat:@"No class name in page definition for tag named:%@ definitionsElement=%@ [#%d,#%d]", [self addErrorMessageFormat:@"No element definition for tag named:%@ [#%d,#%d]",
nodeNameAttribute, nodeNameAttribute,
definitionsElement,
currentGSWebTagN, currentGSWebTagN,
currentTagN]; currentTagN];
}; }
};
// No class name mean we'll raise an exception after so don't care about this part...
if (className) //
{
NSDebugMLLog(@"GSWTemplateParser",@"node=%p associations:%@",currentNode,_associations);
{
NSEnumerator* _nodeAttributesEnum = [nodeAttributes keyEnumerator];
id _tagAttrKey=nil;
id _tagAttrValue=nil;
NSMutableDictionary* _addedAssoc=nil;
while ((_tagAttrKey = [_nodeAttributesEnum nextObject]))
{
if (![_tagAttrKey isEqualToString:@"name"] && ![_associations objectForKey:_tagAttrKey])
{
if (!_addedAssoc)
_addedAssoc=(NSMutableDictionary*)[NSMutableDictionary dictionary];
_tagAttrValue=[nodeAttributes objectForKey:_tagAttrKey];
[_addedAssoc setObject:[GSWAssociation associationWithValue:_tagAttrValue]
forKey:_tagAttrKey];
};
};
if (_addedAssoc)
{
_associations=[_associations dictionaryByAddingEntriesFromDictionary:_addedAssoc];
};
};
NSDebugMLLog(@"GSWTemplateParser",@"node=%p gsweb name=%@ dynamicElementWithName: children=%@",
currentNode,
nodeNameAttribute,
children);
NSDebugMLLog(@"GSWTemplateParser",@"node=%p %@ [Type:%@] [%@] ##%s##\n",
currentNode,
[currentNode name],
[currentNode typeDescription],
[currentNode propertiesAsDictionaryWithKeyTransformationSel:NULL],
[[currentNode content] lossyCString]);
aStaticGroup=[[[GSWHTMLStaticGroup alloc]initWithContentElements:children]autorelease];
elem=[GSWApp dynamicElementWithName:className
associations:_associations
template:aStaticGroup
languages:_languages];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p element=%@ StaticGroup %p=%@",currentNode,elem,aStaticGroup,aStaticGroup);
if (elem)
[elem setDefinitionName:[definitionsElement elementName]];
else else
{ {
// We don't raise exception know because it's better for developper to collect and report all errors before :-) _associations=[definitionsElement associations];
[self addErrorMessageFormat:@"Creation failed for element named:%@ className:%@", className=[definitionsElement className];
[definitionsElement elementName], NSDebugMLLog(@"GSWTemplateParser",@"node=%p GSWeb Tag className:[%@]",currentNode,className);
className]; if (!className)
{
// We don't raise exception know because it's better for developper to collect and report all errors before :-)
[self addErrorMessageFormat:@"No class name in page definition for tag named:%@ definitionsElement=%@ [#%d,#%d]",
nodeNameAttribute,
definitionsElement,
currentGSWebTagN,
currentTagN];
};
};
// No class name mean we'll raise an exception after so don't care about this part...
if (className) //
{
NSDebugMLLog(@"GSWTemplateParser",@"node=%p associations:%@",currentNode,_associations);
{
NSEnumerator* _nodeAttributesEnum = [nodeAttributes keyEnumerator];
id _tagAttrKey=nil;
id _tagAttrValue=nil;
NSMutableDictionary* _addedAssoc=nil;
while ((_tagAttrKey = [_nodeAttributesEnum nextObject]))
{
if (![_tagAttrKey isEqualToString:@"name"] && ![_associations objectForKey:_tagAttrKey])
{
if (!_addedAssoc)
_addedAssoc=(NSMutableDictionary*)[NSMutableDictionary dictionary];
_tagAttrValue=[nodeAttributes objectForKey:_tagAttrKey];
[_addedAssoc setObject:[GSWAssociation associationWithValue:_tagAttrValue]
forKey:_tagAttrKey];
};
};
if (_addedAssoc)
{
_associations=[_associations dictionaryByAddingEntriesFromDictionary:_addedAssoc];
};
};
NSDebugMLLog(@"GSWTemplateParser",@"node=%p gsweb name=%@ dynamicElementWithName: children=%@",
currentNode,
nodeNameAttribute,
children);
NSDebugMLLog(@"GSWTemplateParser",@"node=%p %@ [Type:%@] [%@] ##%s##\n",
currentNode,
[currentNode name],
[currentNode typeDescription],
[currentNode propertiesAsDictionaryWithKeyTransformationSel:NULL],
[[currentNode content] lossyCString]);
aStaticGroup=[[[GSWHTMLStaticGroup alloc]initWithContentElements:children]autorelease];
elem=[GSWApp dynamicElementWithName:className
associations:_associations
template:aStaticGroup
languages:_languages];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p element=%@ StaticGroup %p=%@",currentNode,elem,aStaticGroup,aStaticGroup);
if (elem)
[elem setDefinitionName:[definitionsElement elementName]];
else
{
// We don't raise exception know because it's better for developper to collect and report all errors before :-)
[self addErrorMessageFormat:@"Creation failed for element named:%@ className:%@",
[definitionsElement elementName],
className];
};
}; };
}; };
};
}
else
{
//It's a hack to remove html & body elements where there's not in the template (HTML parser add them when there are missing)
if ((!_isHTMLTag
&& [nodeName caseInsensitiveCompare:@"html"]==NSOrderedSame
&& [nodeAttributes count]==0)
|| (!_isBodyTag
&& [nodeName caseInsensitiveCompare:@"body"]==NSOrderedSame
&& [nodeAttributes count]==0))
{
NSDebugMLLog(@"GSWTemplateParser",@"node=%p StaticElement: children=%@",currentNode,children);
elem=[[[GSWHTMLStaticElement alloc]initWithName:nil
attributeDictionary:nil
contentElements:children]autorelease];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p element=%@",currentNode,elem);
} }
else else
{ {
NSDictionary* _associations=nil; //It's a hack to remove html & body elements where there's not in the template (HTML parser add them when there are missing)
NSEnumerator* _nodeAttributesEnum = [nodeAttributes keyEnumerator]; if ((!_isHTMLTag
id _tagAttrKey=nil; && [nodeName caseInsensitiveCompare:@"html"]==NSOrderedSame
id _tagAttrValue=nil; && [nodeAttributes count]==0)
NSMutableDictionary* _addedAssoc=nil; || (!_isBodyTag
NSDebugMLLog(@"GSWTemplateParser",@"node=%p Create nodeName=%@",currentNode,nodeName); && [nodeName caseInsensitiveCompare:@"body"]==NSOrderedSame
while ((_tagAttrKey = [_nodeAttributesEnum nextObject])) && [nodeAttributes count]==0))
{ {
if (![_tagAttrKey isEqualToString:@"name"] && ![_associations objectForKey:_tagAttrKey]) NSDebugMLLog(@"GSWTemplateParser",@"node=%p StaticElement: children=%@",currentNode,children);
elem=[[[GSWHTMLStaticElement alloc]initWithName:nil
attributeDictionary:nil
contentElements:children]autorelease];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p element=%@",currentNode,elem);
}
else
{
NSDictionary* _associations=nil;
NSEnumerator* _nodeAttributesEnum = [nodeAttributes keyEnumerator];
id _tagAttrKey=nil;
id _tagAttrValue=nil;
NSMutableDictionary* _addedAssoc=nil;
NSDebugMLLog(@"GSWTemplateParser",@"node=%p Create nodeName=%@",currentNode,nodeName);
while ((_tagAttrKey = [_nodeAttributesEnum nextObject]))
{ {
if (!_addedAssoc) if (![_tagAttrKey isEqualToString:@"name"] && ![_associations objectForKey:_tagAttrKey])
_addedAssoc=(NSMutableDictionary*)[NSMutableDictionary dictionary]; {
_tagAttrValue=[nodeAttributes objectForKey:_tagAttrKey]; if (!_addedAssoc)
[_addedAssoc setObject:[GSWAssociation associationWithValue:_tagAttrValue] _addedAssoc=(NSMutableDictionary*)[NSMutableDictionary dictionary];
forKey:_tagAttrKey]; _tagAttrValue=[nodeAttributes objectForKey:_tagAttrKey];
[_addedAssoc setObject:[GSWAssociation associationWithValue:_tagAttrValue]
forKey:_tagAttrKey];
};
}; };
}; if (_addedAssoc)
if (_addedAssoc)
{
_associations=[NSDictionary dictionaryWithDictionary:_addedAssoc];
};
//To know if it's an autoclose tag
if (!children && [self isKindOfClass:[GSWTemplateParserXMLHTML class]])
{
htmlElemDescPtr elemDscr=NULL;
elemDscr=htmlTagLookup([nodeName lossyCString]);
if (elemDscr
&& elemDscr->endTag!=2 //Forbidden End Tag
&& elemDscr->endTag!=1) //End can be omitted
{ {
children=[NSArray array]; _associations=[NSDictionary dictionaryWithDictionary:_addedAssoc];
}; };
//To know if it's an autoclose tag
if (!children && [self isKindOfClass:[GSWTemplateParserXMLHTML class]])
{
htmlElemDescPtr elemDscr=NULL;
elemDscr=htmlTagLookup([nodeName lossyCString]);
if (elemDscr
&& elemDscr->endTag!=2 //Forbidden End Tag
&& elemDscr->endTag!=1) //End can be omitted
{
children=[NSArray array];
};
};
NSDebugMLLog(@"GSWTemplateParser",@"node=%p StaticElement: children=%@",currentNode,children);
elem=[[[GSWHTMLStaticElement alloc]initWithName:nodeName
attributeDictionary:_associations
contentElements:children]autorelease];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p element=%@",currentNode,elem);
}; };
NSDebugMLLog(@"GSWTemplateParser",@"node=%p StaticElement: children=%@",currentNode,children);
elem=[[[GSWHTMLStaticElement alloc]initWithName:nodeName
attributeDictionary:_associations
contentElements:children]autorelease];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p element=%@",currentNode,elem);
}; };
}; };
};
break;
}; };
}; if (elem)
break; [_elements addObject:elem];
NSDebugMLLog(@"GSWTemplateParser",@"END node=%p %@ [Type:%@] [%@] ##%s##\n",
currentNode,
[currentNode name],
[currentNode typeDescription],
[currentNode propertiesAsDictionaryWithKeyTransformationSel:NULL],
[[currentNode content] lossyCString]);
currentNode=[currentNode next];
}; };
if (elem) }
[_elements addObject:elem]; NS_HANDLER
NSDebugMLLog(@"GSWTemplateParser",@"END node=%p %@ [Type:%@] [%@] ##%s##\n", {
currentNode, LOGError(@"%@ createElementsFromNode: Exception",
[currentNode name], [self logPrefix]);
[currentNode typeDescription], localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
[currentNode propertiesAsDictionaryWithKeyTransformationSel:NULL], @"%@ In [GSWTemplateParserXML createElementsFromNode:]...",
[[currentNode content] lossyCString]); [self logPrefix]);
currentNode=[currentNode next]; [localException retain];
}; GSWLogMemCF("Destroy NSAutoreleasePool: %p",arp);
DESTROY(arp);
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER;
GSWLogMemCF("Destroy NSAutoreleasePool: %p",arp);
DESTROY(arp); DESTROY(arp);
LOGObjectFnStop(); LOGObjectFnStop();
NSDebugMLLog(@"GSWTemplateParser",@"_elements=%@",_elements); NSDebugMLLog(@"GSWTemplateParser",@"_elements=%@",_elements);

View file

@ -180,9 +180,6 @@ extern void pidstatm(pid_t pid, proc_t* P);
extern NSString* GSWGetDefaultDocRoot(); extern NSString* GSWGetDefaultDocRoot();
//To Move
extern NSString* DataToHexString(NSData* data);
extern NSData* HexStringToData(NSString* _string);
//==================================================================== //====================================================================
@interface NSException (NSBuild) @interface NSException (NSBuild)

View file

@ -1583,68 +1583,6 @@ NSString* GSWGetDefaultDocRoot()
rootDoc=[NSString stringWithString:@"/home/httpd/gsweb"]; rootDoc=[NSString stringWithString:@"/home/httpd/gsweb"];
return rootDoc; return rootDoc;
}; };
//--------------------------------------------------------------------
//To Move
//--------------------------------------------------------------------
NSString* DataToHexString(NSData* data)
{
unsigned int size=0;
size=[data length];
if (size)
{
const unsigned char* pData=(const unsigned char*)[data bytes];
if (pData)
{
NSMutableString* string=[[NSMutableString new] autorelease];
int i=0;
for(i=0;i<size;i++)
{
[string appendFormat:@"%02x",(unsigned int)pData[i]];
};
return string;
};
};
return nil;
};
//--------------------------------------------------------------------
NSData* HexStringToData(NSString* string)
{
int size=[string length];
if (size>0)
{
const char* pString=(const char*)[[string uppercaseString]cString];
if (pString)
{
NSMutableData* data=[NSMutableData dataWithLength:size/2];
unsigned char* pData=(unsigned char*)[data bytes];
int i=0;
for(i=0;i<size/2;i++)
{
if (pString[i*2]>='0' && pString[i*2]<='9')
pData[i]=(pString[i*2]-'0') << 4;
else if (pString[i*2]>='A' && pString[i*2]<='F')
pData[i]=(pString[i*2]-'A'+10) << 4;
else
{
NSCAssert(NO,@"Bad hex String");
};
if (pString[i*2+1]>='0' && pString[i*2+1]<='9')
pData[i]=pData[i]|(pString[i*2+1]-'0');
else if (pString[i*2+1]>='A' && pString[i*2+1]<='F')
pData[i]=pData[i]|(pString[i*2+1]-'A'+10);
else
{
NSCAssert(NO,@"Bad hex String");
};
};
return data;
};
};
return nil;
};
//=================================================================================== //===================================================================================
@implementation NSDictionary (SBDictionary) @implementation NSDictionary (SBDictionary)

View file

@ -31,6 +31,7 @@
static const char rcsId[] = "$Id$"; static const char rcsId[] = "$Id$";
#include "GSWeb.h" #include "GSWeb.h"
#include <gnustep/base/GSCategories.h>
#include <time.h> #include <time.h>
//==================================================================== //====================================================================
@ -176,7 +177,7 @@ static const char rcsId[] = "$Id$";
pData=[data mutableBytes]; pData=[data mutableBytes];
NSAssert(pData,@"no pData"); NSAssert(pData,@"no pData");
NSDebugMLog(@"pData=%p",pData); //NSDebugMLog(@"pData=%p",pData);
*((NSTimeInterval*)pData)=ti; *((NSTimeInterval*)pData)=ti;
pData+=sizeof(ti); pData+=sizeof(ti);
@ -185,13 +186,16 @@ static const char rcsId[] = "$Id$";
srand(time(NULL)); srand(time(NULL));
for(i=0;i<length;i++) for(i=0;i<length;i++)
{ {
*((unsigned char*)pData)=(unsigned char)(256*rand()/(RAND_MAX+1.0)); int c=rand();
*((unsigned char*)pData)=(unsigned char)(256.0*c/(RAND_MAX+1.0));
//NSDebugMLog(@"i=%d c=%i max=%d c=%u",i,c,(int)RAND_MAX,(unsigned int)(*((unsigned char*)pData)));
pData++; pData++;
}; };
NSDebugMLog(@"pData=%p",pData); //NSDebugMLog(@"pData=%p",pData);
//NSDebugMLog(@"pData length=%d",(int)(pData-[data mutableBytes]));
dataHex=DataToHexString(data); dataHex=[data hexadecimalRepresentation];
NSDebugMLog(@"dataHex %p=%@",dataHex,dataHex); //NSDebugMLog(@"dataHex %p=%@",dataHex,dataHex);
return dataHex; return dataHex;
}; };

View file

@ -2,7 +2,7 @@
# #
# #
DYNAMIC_LINKER=simple DYNAMIC_LINKER=simple
GDL2=yes GDL2=@GDL2@
LIBWRAP=@LIBWRAP@ LIBWRAP=@LIBWRAP@
#Log Memory Alloc/Dealloc #Log Memory Alloc/Dealloc

34
configure vendored
View file

@ -1173,8 +1173,41 @@ fi
echo "$as_me:$LINENO: result: $GSWNAMES" >&5 echo "$as_me:$LINENO: result: $GSWNAMES" >&5
echo "${ECHO_T}$GSWNAMES" >&6 echo "${ECHO_T}$GSWNAMES" >&6
#--------------------------------------------------------------------
# Check for GDL2
#--------------------------------------------------------------------
as_ac_File=`echo "ac_cv_file_$GNUSTEP_MAKEFILES/Auxiliary/gdl2.make" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $GNUSTEP_MAKEFILES/Auxiliary/gdl2.make" >&5
echo $ECHO_N "checking for $GNUSTEP_MAKEFILES/Auxiliary/gdl2.make... $ECHO_C" >&6
if eval "test \"\${$as_ac_File+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
test "$cross_compiling" = yes &&
{ { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
{ (exit 1); exit 1; }; }
if test -r "$GNUSTEP_MAKEFILES/Auxiliary/gdl2.make"; then
eval "$as_ac_File=yes"
else
eval "$as_ac_File=no"
fi
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
if test `eval echo '${'$as_ac_File'}'` = yes; then
GDL2=yes
else
GDL2=no
fi
if test "$GDL2" = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_GDL2 1
_ACEOF
fi
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Check for libwrap # Check for libwrap
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -2874,6 +2907,7 @@ s,@ECHO_N@,$ECHO_N,;t t
s,@ECHO_T@,$ECHO_T,;t t s,@ECHO_T@,$ECHO_T,;t t
s,@LIBS@,$LIBS,;t t s,@LIBS@,$LIBS,;t t
s,@GSWNAMES@,$GSWNAMES,;t t s,@GSWNAMES@,$GSWNAMES,;t t
s,@GDL2@,$GDL2,;t t
s,@CC@,$CC,;t t s,@CC@,$CC,;t t
s,@CFLAGS@,$CFLAGS,;t t s,@CFLAGS@,$CFLAGS,;t t
s,@LDFLAGS@,$LDFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t

View file

@ -43,7 +43,15 @@ else
fi fi
AC_MSG_RESULT($GSWNAMES) AC_MSG_RESULT($GSWNAMES)
AC_SUBST(GSWNAMES) AC_SUBST(GSWNAMES)
#--------------------------------------------------------------------
# Check for GDL2
#--------------------------------------------------------------------
AC_CHECK_FILE($GNUSTEP_MAKEFILES/Auxiliary/gdl2.make, GDL2=yes, GDL2=no)
if test "$GDL2" = yes; then
AC_DEFINE(HAVE_GDL2)
fi
AC_SUBST(GDL2)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Check for libwrap # Check for libwrap

View file

@ -3,7 +3,7 @@
# #
# Makefile flags and configs to build with the base library. # Makefile flags and configs to build with the base library.
# #
# Copyright (C) 2002 Free Software Foundation, Inc. # Copyright (C) 2002-2003 Free Software Foundation, Inc.
# #
# Author: Mirko Viviani <mirko.viviani@rccr.cremona.it> # Author: Mirko Viviani <mirko.viviani@rccr.cremona.it>
# Based on code originally in the gnustep make package # Based on code originally in the gnustep make package
@ -35,7 +35,12 @@ endif
AUXILIARY_GSW_LIBS += -lGSWeb$(GSWEXT) -lGSWExtensions$(GSWEXT) -lGSWExtensionsGSW$(GSWEXT) AUXILIARY_GSW_LIBS += -lGSWeb$(GSWEXT) -lGSWExtensions$(GSWEXT) -lGSWExtensionsGSW$(GSWEXT)
AUXILIARY_INCLUDE_DIRS += @AUX_INCS@ AUXILIARY_INCLUDE_DIRS += @AUX_INCS@
AUXILIARY_INCLUDE_LIBS += @AUX_LIBS@ -lGSANTLR AUXILIARY_TOOL_LIBS += @AUX_LIBS@ -lGSANTLR
GDL2=@GDL2@
ifeq ($(GDL2),yes)
ADDITIONAL_OBJCFLAGS += -DGDL2=1
endif
endif # GSWEB_MAKE_LOADED endif # GSWEB_MAKE_LOADED