mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-06-04 19:11:17 +00:00
o remove response saving (now use recording)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@18164 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b7ab1bed16
commit
1a437a835a
2 changed files with 6 additions and 59 deletions
|
@ -1,5 +1,6 @@
|
|||
/** GSWDefaultAdaptorThread.h - GSWeb: Class GSWDefaultAdaptorThread
|
||||
Copyright (C) 1999-2002 Free Software Foundation, Inc.
|
||||
/** GSWDefaultAdaptorThread.h - <title>GSWeb: Class GSWDefaultAdaptorThread</title>
|
||||
|
||||
Copyright (C) 1999-2003 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
Date: Feb 1999
|
||||
|
@ -82,9 +83,6 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
|
|||
+(void)sendRetryLasterResponseToStream:(NSFileHandle*)stream;
|
||||
+(void)sendConnectionRefusedResponseToStream:(NSFileHandle*)stream
|
||||
withMessage:(NSString*)message;
|
||||
+(void)saveResponse:(GSWResponse*)response
|
||||
data:(NSData*)allResponseData
|
||||
remoteAddress:(NSString*)remoteAddress;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -377,7 +377,7 @@ RCS_ID("$Id$")
|
|||
NSMutableData* pendingData=nil;
|
||||
NSDate* maxDate=[NSDate dateWithTimeIntervalSinceNow:360]; //360s
|
||||
NSData* dataBlock=nil;
|
||||
int sleepTime=250; //250ms
|
||||
double sleepTime=0.250; //250ms
|
||||
int readenBytesNb=0;
|
||||
int headersBytesNb=0;
|
||||
int dataBytesNb=0;
|
||||
|
@ -524,7 +524,7 @@ RCS_ID("$Id$")
|
|||
isElapsed=[[NSDate date]compare:maxDate]==NSOrderedDescending;
|
||||
if (!isElapsed)
|
||||
{
|
||||
usleep(sleepTime);//Is this the good method ? //TODOV
|
||||
NSTimeIntervalSleep(sleepTime);//Is this the good method ? //TODOV
|
||||
isElapsed=[[NSDate date]compare:maxDate]==NSOrderedDescending;
|
||||
};
|
||||
};
|
||||
|
@ -575,7 +575,7 @@ RCS_ID("$Id$")
|
|||
if ([requestLineArray count]!=3)
|
||||
{
|
||||
ExceptionRaise(@"GSWDefaultAdaptorThread",
|
||||
@"bad request first line (elements count %d != 3).\nrequestLine: %@\nrequestLineArray: %@",
|
||||
@"bad request first line (elements count %d != 3). requestLine: '%@'.RequestLineArray: %@",
|
||||
[requestLineArray count],
|
||||
requestLine,
|
||||
requestLineArray);
|
||||
|
@ -692,9 +692,6 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
|
|||
GSWHTTPHeader_Response_OK,
|
||||
GSWHTTPHeader_Response_HeaderLineEnd[requestNamingConv]];
|
||||
NSString* empty=[NSString stringWithString:@"\n"];
|
||||
NSDebugDeepMLLog(@"low",@"[GSWApplication saveResponsesPath]:%@",[GSWApplication saveResponsesPath]);
|
||||
if ([GSWApplication saveResponsesPath])
|
||||
allResponseData=(NSMutableData*)[NSMutableData data];
|
||||
|
||||
NSDebugDeepMLLog(@"low",@"head:%@",head);
|
||||
NSDebugDeepMLLog(@"low",@"responseData:%@",responseData);
|
||||
|
@ -724,7 +721,6 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
|
|||
[responseData appendData:[empty dataUsingEncoding:NSASCIIStringEncoding]];
|
||||
NSDebugDeepMLLog(@"low",@"responseData:%@",responseData);
|
||||
|
||||
[allResponseData appendData:responseData];
|
||||
NS_DURING
|
||||
{
|
||||
[aStream writeData:responseData];
|
||||
|
@ -755,7 +751,6 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
|
|||
encoding:NSISOLatin1StringEncoding]
|
||||
autorelease]);
|
||||
|
||||
[allResponseData appendData:responseData];
|
||||
NS_DURING
|
||||
{
|
||||
[aStream writeData:responseData];
|
||||
|
@ -773,10 +768,6 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
|
|||
NS_ENDHANDLER;
|
||||
NSDebugDeepMLLog0(@"info",@"Response content Written");
|
||||
};
|
||||
if (allResponseData)
|
||||
[self saveResponse:response
|
||||
data:allResponseData
|
||||
remoteAddress:remoteAddress];
|
||||
};
|
||||
[aStream closeFile];
|
||||
LOGObjectFnStop();
|
||||
|
@ -852,46 +843,4 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
|
|||
DESTROY(pool);
|
||||
};
|
||||
|
||||
+(NSString*)savedResponseFilenameWithResponse:(GSWResponse*)response
|
||||
remoteAddress:(NSString*)remoteAddress
|
||||
{
|
||||
NSString* dateString=[[NSCalendarDate calendarDate] descriptionWithCalendarFormat:@"%Y-%m-%d_%H-%M-%S.%F"];
|
||||
return [NSString stringWithFormat:@"GSWeb-%@-Response-%@-%@-%p",
|
||||
[[GSWApplication application]name],
|
||||
dateString,
|
||||
(remoteAddress ? remoteAddress : @"unknown"),
|
||||
response];
|
||||
};
|
||||
|
||||
+(void)saveResponse:(GSWResponse*)response
|
||||
data:(NSData*)allResponseData
|
||||
remoteAddress:(NSString*)remoteAddress
|
||||
{
|
||||
NSString* path=nil;
|
||||
LOGObjectFnStart();
|
||||
path=[GSWApplication saveResponsesPath];
|
||||
if (path)
|
||||
{
|
||||
path=[path stringByAppendingPathComponent:[self savedResponseFilenameWithResponse:response
|
||||
remoteAddress:remoteAddress]];
|
||||
NSDebugDeepMLog(@"path=%@:",path);
|
||||
NS_DURING
|
||||
{
|
||||
NSString* str=[[[NSString alloc]initWithData:allResponseData
|
||||
encoding:NSASCIIStringEncoding]autorelease];
|
||||
[str writeToFile:path
|
||||
atomically:NO];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException(@"GSWDefaultAdaptorThread: Exception:%@ (%@)",
|
||||
localException,[localException reason]);
|
||||
NSDebugMLog(@"EXCEPTION GSWDefaultAdaptorThread: Exception:%@ (%@)",
|
||||
localException,[localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
LOGObjectFnStop();
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue