2000-08-14 Manuel Guesdon <mguesdon@orange-concept.com>

* GSWeb.framework/GSWApplication.m: added "exit" in terminate
		generate simple response in -handleException:inContext:
		be sure to have a context in -_handleException:inContext:
		generate simple response in  -_handleException:inContext:
		generate simple response in  -handlePageRestorationErrorInContext:
		be sure to have a context in -_handlePageRestorationErrorInContext:
		generate simple response in  -_handlePageRestorationErrorInContext:
		generate simple response in  -handleSessionCreationErrorInContext:
		generate simple response in  -handleSessionRestorationErrorInContext:
		be sure to have a context in -_handleSessionRestorationErrorInContext:
		generate simple response in  -_handleSessionRestorationErrorInContext:
	* GSWeb.framework/GSWComponentRequestHandler.m: added default response when we catch exceptions,...
		handle more exceptions
	* GSWeb.framework/GSWConstants.h/.m: added GSWHTTPHeader_UserAgent
	* GSWeb.framework/GSWDefaultAdaptor.m: terminate application if it is locked
	* GSWeb.framework/GSWDefaultAdaptorThread.m: Added default response to handle exceptions and various errors
		Correct bug in request data reading (request datas were sometimes not complely readen)
	* GSWeb.framework/GSWFileUpload.m: Added Exception handling
	* GSWeb.framework/GSWRequest.m: add exception handling
	* GSWeb.framework/GSWResponse.h/.m: added  GSWResponse (GSWResponseError)
	* GSWAdaptor/Apache/GNUmakefile: added -DEAPI
	* GSWAdaptor/Apache/mod_gsweb.c: added debug traces
	* GSWAdaptor/common/GSWConfig.c/.h: added debug traces, added init parameter
	* Makefile.postamble: added docs generation
	* Doc/GNUstepWeb-HOWTO moved to howto.gsdoc
	* Doc/gsweb.gsdoc: new file
	* GSWeb.framework/Makefile.postamble: added docs generation
	* GSWExtensions.framework/Makefile.postamble: added docs generation
	* GSWExtensionsGSW.framework/Makefile.postamble: added docs generation


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@7244 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Manuel Guesdon 2000-08-25 10:36:16 +00:00
parent 4cf01b08f9
commit 77cbf60540
23 changed files with 801 additions and 418 deletions

View file

@ -182,7 +182,10 @@ static char rcsId[] = "$Id$";
NS_ENDHANDLER;
if (!response)
{
//TODO
response=[GSWResponse responseWithMessage:@"Application returned no response"
inContext:nil
forRequest:request];
[response _finalizeInContext:nil]; //DO Call _finalizeInContext: !
};
if (response)
{
@ -324,6 +327,9 @@ static char rcsId[] = "$Id$";
}
else
{
#define REQUEST_METHOD__UNKNOWN 0
#define REQUEST_METHOD__GET 1
#define REQUEST_METHOD__POST 2
NSMutableData* _pendingData=nil;
NSDate* maxDate=[NSDate dateWithTimeIntervalSinceNow:360]; //360s
NSData* dataBlock=nil;
@ -333,11 +339,14 @@ static char rcsId[] = "$Id$";
int dataBytesNb=0;
int dataBlockLength=0;
int contentLength=-1;
int _requestMethod=REQUEST_METHOD__UNKNOWN;
BOOL _isRequestLineSetted=NO;
BOOL _isDataStep=NO;
BOOL _isAllDataReaden=NO;
BOOL _isElapsed=NO;
NSMutableDictionary* _headers=nil;
NSString* _userAgent=nil;
NSString* _remoteAddr=nil;
NSDebugMLog0(@"dataBlock try reading");
do
{
@ -404,6 +413,21 @@ static char rcsId[] = "$Id$";
};
if ([_key isEqualToString:GSWHTTPHeader_ContentLength])
contentLength=[_value intValue];
else if ([_key isEqualToString:GSWHTTPHeader_Method])
{
if ([_value isEqualToString:GSWHTTPHeader_MethodPost])
_requestMethod=REQUEST_METHOD__POST;
else if ([_value isEqualToString:GSWHTTPHeader_MethodGet])
_requestMethod=REQUEST_METHOD__GET;
else
{
NSAssert1(NO,@"Unknwon method %@",_value);
};
}
else if ([_key isEqualToString:GSWHTTPHeader_UserAgent])
_userAgent=_value;
else if ([_key isEqualToString:GSWHTTPHeader_RemoteAddress])
_remoteAddr=_value;
_prevValue=[_headers objectForKey:_key];
NSDebugMLLog(@"low",@"_prevValue:%@",_prevValue);
if (_prevValue)
@ -419,9 +443,15 @@ static char rcsId[] = "$Id$";
};
};
};
if (_isDataStep && (contentLength<0 || readenBytesNb>=contentLength))
_isAllDataReaden=YES;
else
dataBytesNb=[_pendingData length];
if (_isDataStep)
{
if (_requestMethod==REQUEST_METHOD__GET)
_isAllDataReaden=YES;
else if (_requestMethod==REQUEST_METHOD__POST)
_isAllDataReaden=(dataBytesNb>=contentLength);
};
if (!_isAllDataReaden)
{
_isElapsed=[[NSDate date]compare:maxDate]==NSOrderedDescending;
if (!_isElapsed)
@ -431,13 +461,15 @@ static char rcsId[] = "$Id$";
};
};
} while (!_isAllDataReaden && !_isElapsed);
NSDebugMLLog(@"info",@"GSWDefaultAdaptor: _isAllDataReaden=%s _isElapsed=%s readenBytesNb=%d contentLength=%d dataBytesNb=%d headersBytesNb=%d",
_isAllDataReaden ? "YES" : "NO",
_isElapsed ? "YES" : "NO",
readenBytesNb,
contentLength,
dataBytesNb,
headersBytesNb);
NSDebugMLog(@"GSWDefaultAdaptor: _userAgent=%@ _remoteAddr=%@ _isAllDataReaden=%s _isElapsed=%s readenBytesNb=%d contentLength=%d dataBytesNb=%d headersBytesNb=%d",
_userAgent,
_remoteAddr,
_isAllDataReaden ? "YES" : "NO",
_isElapsed ? "YES" : "NO",
readenBytesNb,
contentLength,
dataBytesNb,
headersBytesNb);
ok=_isAllDataReaden;
if (_isAllDataReaden)
{