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>
* GSWeb.framework/WebObjects: removed WO*

View file

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

View file

@ -1,12 +1,13 @@
/** 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>
Date: Jan 1999
$Revision$
$Date$
$Id$
This file is part of the GNUstep Web Library.
@ -168,6 +169,14 @@ extern BOOL WOStrictFlag;
//====================================================================
@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)_finishInitializingSession:(GSWSession*)aSession;
-(GSWSession*)_initializeSessionInContext:(GSWContext*)aContext;

View file

@ -178,6 +178,7 @@ int GSWApplicationMainReal(NSString* applicationClassName,
NSAutoreleasePool *appAutoreleasePool=nil;
appAutoreleasePool = [NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",appAutoreleasePool);
/*
//TODO
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];
DESTROY(GSWApp);
};
GSWLogMemCF("Destroy NSAutoreleasePool: %p",appAutoreleasePool);
DESTROY(appAutoreleasePool);
return result;
};
@ -571,7 +573,7 @@ int GSWApplicationMain(NSString* applicationClassName,
//call adaptorsDispatchRequestsConcurrently
_activeSessionsCountLock=[NSLock new];
_componentDefinitionCache=[GSWMultiKeyDictionary new];
[self setResourceManager:[[GSWResourceManager new]autorelease]];
[self setResourceManager:[self createResourceManager]];
[self setStatisticsStore:[[GSWStatisticsStore new]autorelease]];
if ([[self class]isMonitorEnabled])
{
@ -777,10 +779,10 @@ int GSWApplicationMain(NSString* applicationClassName,
}
NS_HANDLER
{
NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
_globalLockn,
(void*)_globalLock_thread_id,
(void*)objc_thread_id());
NSDebugMLog(@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p",
_globalLockn,
(void*)_globalLock_thread_id,
(void*)objc_thread_id());
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
@"globalLock tmpunlock");
LOGException(@"%@ (%@)",localException,[localException reason]);
@ -1409,6 +1411,31 @@ selfLockn,
//====================================================================
@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
{

View file

@ -1564,8 +1564,20 @@ associationsKeys:(NSArray*)associationsKeys
//--------------------------------------------------------------------
-(GSWResponse*)_generateResponseInContext:(GSWContext*)aContext
{
//OK
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;
GSWRequest* request=nil;
NSString* httpVersion=nil;
@ -1575,8 +1587,6 @@ associationsKeys:(NSArray*)associationsKeys
NSAssert(aContext,@"No context");
NS_DURING
{
response=[[GSWResponse new]autorelease];
[aContext deleteAllElementIDComponents];
request=[aContext request];
NSDebugMLLog(@"GSWComponent",@"request=%@",request);
@ -1648,7 +1658,6 @@ associationsKeys:(NSArray*)associationsKeys
};
NS_ENDHANDLER;
LOGObjectFnStop();
return response;
};
//--------------------------------------------------------------------

View file

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

View file

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

View file

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

View file

@ -1,11 +1,13 @@
/** 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>
Date: Jan 1999
$Revision$
$Date$
$Id$
<abstract></abstract>
@ -28,7 +30,7 @@
</license>
**/
static char rcsId[] = "$Id$";
static const char rcsId[] = "$Id$";
#include "GSWeb.h"
//#include <gnustep/base/UnixFileHandle.h>
@ -297,11 +299,11 @@ int allow_severity = LOG_INFO;
NSDebugDeepMLLog(@"ThreadID=%p - A1 readInProgress=%d\n",
(void*)objc_thread_id(),
(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",
(int)([GSWApplication application]->selfLockn),
(void*)([GSWApplication application]->selfLock_thread_id),
(int)([GSWApplication application]->globalLockn),
(void*)([GSWApplication application]->globalLock_thread_id),
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),
(void*)([GSWApplication application]->_selfLock_thread_id),
(int)([GSWApplication application]->_globalLockn),
(void*)([GSWApplication application]->_globalLock_thread_id),
[_threads count],
[_waitingThreads count],
_blocked);
@ -481,11 +483,11 @@ int allow_severity = LOG_INFO;
[self unlock];
};
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",
(int)([GSWApplication application]->selfLockn),
(void*)([GSWApplication application]->selfLock_thread_id),
(int)([GSWApplication application]->globalLockn),
(void*)([GSWApplication application]->globalLock_thread_id),
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),
(void*)([GSWApplication application]->_selfLock_thread_id),
(int)([GSWApplication application]->_globalLockn),
(void*)([GSWApplication application]->_globalLock_thread_id),
[_threads count],
[_waitingThreads count],
_blocked);
@ -499,11 +501,11 @@ int allow_severity = LOG_INFO;
LOGObjectFnStart();
// NSDebugMLLog(@"trace",@"adaptorThreadExited");
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",
(int)([GSWApplication application]->selfLockn),
(void*)([GSWApplication application]->selfLock_thread_id),
(int)([GSWApplication application]->globalLockn),
(void*)([GSWApplication application]->globalLock_thread_id),
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),
(void*)([GSWApplication application]->_selfLock_thread_id),
(int)([GSWApplication application]->_globalLockn),
(void*)([GSWApplication application]->_globalLock_thread_id),
[_threads count],
[_waitingThreads count],
_blocked);
@ -513,9 +515,11 @@ int allow_severity = LOG_INFO;
NSAutoreleasePool* pool=nil;
#ifndef NDEBUG
pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
NSDebugLockMLLog(@"low",
@"remove thread %p",
(void*)adaptorThread);
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool);
#endif
NS_DURING
@ -527,9 +531,11 @@ int allow_severity = LOG_INFO;
NS_HANDLER
{
pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
LOGException(@"%@ (%@)",
localException,
[localException reason]);
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool);
//TODO
// [self unlock];
@ -538,10 +544,12 @@ int allow_severity = LOG_INFO;
NS_ENDHANDLER;
#ifndef NDEBUG
pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
NSDebugLockMLLog(@"low",
@"[waitingThreads count]=%d [threads count]=%d",
[_waitingThreads count],
[_threads count]);
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool);
#endif
if ([_threads count]==0)
@ -550,9 +558,11 @@ int allow_severity = LOG_INFO;
if (isApplicationRequestHandlingLocked)
{
pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
LOGSeriousError0(@"Application RequestHandling is LOCKED !!!");
NSAssert(NO,@"Application RequestHandling is LOCKED !!!");//TODO-NOW
[[GSWApplication application] terminate];
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool);
};
};
@ -577,10 +587,12 @@ int allow_severity = LOG_INFO;
{
#ifndef NDEBUG
pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
[GSWApplication statusLogWithFormat:@"Lauch waiting Thread"];
NSDebugLockMLLog(@"info",
@"Lauch waiting Thread %p",
(void*)thread);
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool);
#endif
if (_isMultiThreadEnabled)
@ -594,9 +606,11 @@ int allow_severity = LOG_INFO;
NS_HANDLER
{
pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
LOGException(@"%@ (%@)",
localException,
[localException reason]);
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool);
//TODO
// [self unlock];
@ -619,9 +633,11 @@ int allow_severity = LOG_INFO;
NS_HANDLER
{
pool=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
LOGException(@"%@ (%@)",
localException,
[localException reason]);
GSWLogMemCF("Destroy NSAutoreleasePool: %p",pool);
DESTROY(pool);
//TODO
// [self unlock];
@ -631,11 +647,11 @@ int allow_severity = LOG_INFO;
[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",
(int)([GSWApplication application]->selfLockn),
(void*)([GSWApplication application]->selfLock_thread_id),
(int)([GSWApplication application]->globalLockn),
(void*)([GSWApplication application]->globalLock_thread_id),
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),
(void*)([GSWApplication application]->_selfLock_thread_id),
(int)([GSWApplication application]->_globalLockn),
(void*)([GSWApplication application]->_globalLock_thread_id),
[_threads count],
[_waitingThreads count],
_blocked);

View file

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

View file

@ -1,12 +1,13 @@
/** 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>
Date: Feb 1999
$Revision$
$Date$
$Id$
This file is part of the GNUstep Web Library.
@ -27,7 +28,7 @@
</license>
**/
static char rcsId[] = "$Id$";
static const char rcsId[] = "$Id$";
#include "GSWeb.h"
@ -181,7 +182,7 @@ static char rcsId[] = "$Id$";
//OK
GSWResponse* response=nil;
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>"];
LOGObjectFnStop();
return response;

View file

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

View file

@ -1,12 +1,13 @@
/** 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>
Date: Feb 1999
$Revision$
$Date$
$Id$
This file is part of the GNUstep Web Library.
@ -27,7 +28,7 @@
</license>
**/
static char rcsId[] = "$Id$";
static const char rcsId[] = "$Id$";
#include "GSWeb.h"
@ -83,7 +84,7 @@ static char rcsId[] = "$Id$";
GSWURLValuedElementData* data=nil;
LOGObjectFnStart();
NSDebugMLog(@"aKey=%@",aKey);
response=[[GSWResponse new]autorelease];
response=[GSWApp createResponseInContext:nil];
resourceManager=[[GSWApplication application] resourceManager];
data=[resourceManager _cachedDataForKey:aKey];
NSDebugMLog(@"data=%@",data);

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/** 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>
Date: Mar 1999
@ -30,6 +30,8 @@
</license>
**/
static const char rcsId[]="$Id$";
#include "GSWeb.h"
#include <gsantlr/ANTLRCommon.h>
@ -401,6 +403,7 @@
GSWPageDefParser* definitionsParser=nil;
LOGObjectFnStart();
arpParse=[NSAutoreleasePool new];
GSWLogMemCF("New NSAutoreleasePool: %p",arpParse);
definitionsStream=[[ANTLRTextInputStreamString newWithString:aLocalDefinitionString]
autorelease];
definitionsLexer=[[[GSWPageDefLexer alloc]initWithTextStream:definitionsStream]
@ -444,6 +447,7 @@
@"%@ In [definitionsParser document]...",
[self logPrefix]);
[localException retain];
GSWLogMemCF("Destroy NSAutoreleasePool: %p",arpParse);
DESTROY(arpParse);
[localException autorelease];
[localException raise];
@ -453,6 +457,7 @@
[tmpDefinitions retain];
[definitionsIncludes retain];
NSDebugMLLog0(@"low",@"DESTROY(arpParse)\n");
GSWLogMemCF("Destroy NSAutoreleasePool: %p",arpParse);
DESTROY(arpParse);
NSDebugMLLog0(@"low",@"DESTROYED(arpParse)\n");
[tmpDefinitions autorelease];

View file

@ -897,250 +897,269 @@ text [Type:XML_TEXT_NODE] [{}] ####
includesComment=[GSWApplication includeCommentsInResponses];
_elements=[NSMutableArray array];
arp=[NSAutoreleasePool new];
while(currentNode)
GSWLogMemCF("New NSAutoreleasePool: %p",arp);
NS_DURING
{
GSWElement* elem=nil;
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])
while(currentNode)
{
case XML_TEXT_NODE:
{
NSDebugMLog0(@"TEXT");
GSWElement* elem=nil;
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]);
if ([currentNode content] && ([[currentNode content] length] > 0) ) {
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)
switch([currentNode type])
{
nodeAttributes=[currentNode propertiesAsDictionaryWithKeyTransformationSel:@selector(lowercaseString)];
nodeNameAttribute=[nodeAttributes objectForKey:@"name"];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p nodeAttributes=%@",currentNode,nodeAttributes);
NSDebugMLLog(@"GSWTemplateParser",@"node=%p nodeNameAttribute=%@",currentNode,nodeNameAttribute);
tagN++;
if ([nodeName caseInsensitiveCompare:GSWTag_Name[GSWNAMES_INDEX]]==NSOrderedSame
||[nodeName caseInsensitiveCompare:GSWTag_Name[WONAMES_INDEX]]==NSOrderedSame)
gswebTagN++;
currentGSWebTagN=gswebTagN;
currentTagN=tagN;
if ([currentNode firstChild])
case XML_TEXT_NODE:
{
NSDebugMLog0(@"TEXT");
if ([currentNode content] && ([[currentNode content] length] > 0) ) {
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)
{
children=[self createElementsFromNode:[currentNode firstChild]];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p children=%@",currentNode,children);
};
if ([nodeName caseInsensitiveCompare:GSWTag_Name[GSWNAMES_INDEX]]==NSOrderedSame
||[nodeName caseInsensitiveCompare:GSWTag_Name[WONAMES_INDEX]]==NSOrderedSame)
{
GSWPageDefElement* definitionsElement=nil;
if (!nodeNameAttribute)
nodeAttributes=[currentNode propertiesAsDictionaryWithKeyTransformationSel:@selector(lowercaseString)];
nodeNameAttribute=[nodeAttributes objectForKey:@"name"];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p nodeAttributes=%@",currentNode,nodeAttributes);
NSDebugMLLog(@"GSWTemplateParser",@"node=%p nodeNameAttribute=%@",currentNode,nodeNameAttribute);
tagN++;
if ([nodeName caseInsensitiveCompare:GSWTag_Name[GSWNAMES_INDEX]]==NSOrderedSame
||[nodeName caseInsensitiveCompare:GSWTag_Name[WONAMES_INDEX]]==NSOrderedSame)
gswebTagN++;
currentGSWebTagN=gswebTagN;
currentTagN=tagN;
if ([currentNode firstChild])
{
// allow null name tags
elem=[[[GSWHTMLStaticGroup alloc]initWithContentElements:children]autorelease];
}
else
children=[self createElementsFromNode:[currentNode firstChild]];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p children=%@",currentNode,children);
};
if ([nodeName caseInsensitiveCompare:GSWTag_Name[GSWNAMES_INDEX]]==NSOrderedSame
||[nodeName caseInsensitiveCompare:GSWTag_Name[WONAMES_INDEX]]==NSOrderedSame)
{
NSDictionary* _associations=nil;
NSString* className=nil;
GSWHTMLStaticGroup* aStaticGroup=nil;
definitionsElement=[_definitions objectForKey:nodeNameAttribute];
NSDebugMLLog(@"GSWTemplateParser",@"definitionsElement:[%@]",
definitionsElement);
NSDebugMLLog(@"GSWTemplateParser",@"GSWeb Tag definitionsElement:[%@]",
definitionsElement);
if (!definitionsElement)
GSWPageDefElement* definitionsElement=nil;
if (!nodeNameAttribute)
{
// We don't raise exception know because it's better for developper to collect and report all errors before :-)
[self addErrorMessageFormat:@"No element definition for tag named:%@ [#%d,#%d]",
nodeNameAttribute,
currentGSWebTagN,
currentTagN];
// allow null name tags
elem=[[[GSWHTMLStaticGroup alloc]initWithContentElements:children]autorelease];
}
else
{
_associations=[definitionsElement associations];
className=[definitionsElement className];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p GSWeb Tag className:[%@]",currentNode,className);
if (!className)
NSDictionary* _associations=nil;
NSString* className=nil;
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 :-)
[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,
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];
_associations=[definitionsElement associations];
className=[definitionsElement className];
NSDebugMLLog(@"GSWTemplateParser",@"node=%p GSWeb Tag className:[%@]",currentNode,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
{
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]))
//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))
{
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)
_addedAssoc=(NSMutableDictionary*)[NSMutableDictionary dictionary];
_tagAttrValue=[nodeAttributes objectForKey:_tagAttrKey];
[_addedAssoc setObject:[GSWAssociation associationWithValue:_tagAttrValue]
forKey:_tagAttrKey];
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=[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
if (_addedAssoc)
{
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;
};
};
break;
if (elem)
[_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];
NSDebugMLLog(@"GSWTemplateParser",@"END node=%p %@ [Type:%@] [%@] ##%s##\n",
currentNode,
[currentNode name],
[currentNode typeDescription],
[currentNode propertiesAsDictionaryWithKeyTransformationSel:NULL],
[[currentNode content] lossyCString]);
currentNode=[currentNode next];
};
}
NS_HANDLER
{
LOGError(@"%@ createElementsFromNode: Exception",
[self logPrefix]);
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,
@"%@ In [GSWTemplateParserXML createElementsFromNode:]...",
[self logPrefix]);
[localException retain];
GSWLogMemCF("Destroy NSAutoreleasePool: %p",arp);
DESTROY(arp);
[localException autorelease];
[localException raise];
}
NS_ENDHANDLER;
GSWLogMemCF("Destroy NSAutoreleasePool: %p",arp);
DESTROY(arp);
LOGObjectFnStop();
NSDebugMLLog(@"GSWTemplateParser",@"_elements=%@",_elements);

View file

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

View file

@ -1583,68 +1583,6 @@ NSString* GSWGetDefaultDocRoot()
rootDoc=[NSString stringWithString:@"/home/httpd/gsweb"];
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)

View file

@ -31,6 +31,7 @@
static const char rcsId[] = "$Id$";
#include "GSWeb.h"
#include <gnustep/base/GSCategories.h>
#include <time.h>
//====================================================================
@ -176,7 +177,7 @@ static const char rcsId[] = "$Id$";
pData=[data mutableBytes];
NSAssert(pData,@"no pData");
NSDebugMLog(@"pData=%p",pData);
//NSDebugMLog(@"pData=%p",pData);
*((NSTimeInterval*)pData)=ti;
pData+=sizeof(ti);
@ -185,13 +186,16 @@ static const char rcsId[] = "$Id$";
srand(time(NULL));
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++;
};
NSDebugMLog(@"pData=%p",pData);
//NSDebugMLog(@"pData=%p",pData);
//NSDebugMLog(@"pData length=%d",(int)(pData-[data mutableBytes]));
dataHex=DataToHexString(data);
NSDebugMLog(@"dataHex %p=%@",dataHex,dataHex);
dataHex=[data hexadecimalRepresentation];
//NSDebugMLog(@"dataHex %p=%@",dataHex,dataHex);
return dataHex;
};

View file

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

34
configure vendored
View file

@ -1173,8 +1173,41 @@ fi
echo "$as_me:$LINENO: result: $GSWNAMES" >&5
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
#--------------------------------------------------------------------
@ -2874,6 +2907,7 @@ s,@ECHO_N@,$ECHO_N,;t t
s,@ECHO_T@,$ECHO_T,;t t
s,@LIBS@,$LIBS,;t t
s,@GSWNAMES@,$GSWNAMES,;t t
s,@GDL2@,$GDL2,;t t
s,@CC@,$CC,;t t
s,@CFLAGS@,$CFLAGS,;t t
s,@LDFLAGS@,$LDFLAGS,;t t

View file

@ -43,7 +43,15 @@ else
fi
AC_MSG_RESULT($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

View file

@ -3,7 +3,7 @@
#
# 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>
# Based on code originally in the gnustep make package
@ -35,7 +35,12 @@ endif
AUXILIARY_GSW_LIBS += -lGSWeb$(GSWEXT) -lGSWExtensions$(GSWEXT) -lGSWExtensionsGSW$(GSWEXT)
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