2003-04-09 Manuel Guesdon <mguesdon@orange-concept.com>

* GSWeb.framework/GSWSessionTimeOut.m:
		o fix in -description
	* GSWeb.framework/GSWApplication.m:
		o build currentRunLop before calling -run
		o log allFrameworks when a component is not found
	* GSWeb.framework/GSWHyperlink.m:
		o better handling of isSecure (regarding current request secure state)
	* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswd:
		o use "" pageName so application may choose the main page
	* GSWExtensions.framework/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.gswd:
		o use "" pageName so application may choose the main page
	* GSWeb.framework/GSWConstants.m/.h:
		o added GSWHTTPHeader_Protocol, GSWHTTPHeader_ProtocolNum,
			GSWHTTPHeader_RequestScheme
	* GSWeb.framework/GSWContext.m/.h:
		o fix in -_synchronizeForDistribution
		o try to avoid complete URL when we can use relative one
	* GSWeb.framework/GSWRequest.m:
		o fix to retrieve protocol & port from adaptor headers
	* GSWeb.framework/GSWSession.m:
		o fix in -appendCookieToResponse:
	* GSAdaptors/Apache/mod_gsweb.c:
		o fix for server port header


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@16400 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mguesdon 2003-04-09 12:03:17 +00:00
parent 88c99d872f
commit d4a225d8c8
13 changed files with 215 additions and 58 deletions

View file

@ -1,3 +1,28 @@
2003-04-09 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWSessionTimeOut.m:
o fix in -description
* GSWeb.framework/GSWApplication.m:
o build currentRunLop before calling -run
o log allFrameworks when a component is not found
* GSWeb.framework/GSWHyperlink.m:
o better handling of isSecure (regarding current request secure state)
* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswd:
o use "" pageName so application may choose the main page
* GSWExtensions.framework/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.gswd:
o use "" pageName so application may choose the main page
* GSWeb.framework/GSWConstants.m/.h:
o added GSWHTTPHeader_Protocol, GSWHTTPHeader_ProtocolNum,
GSWHTTPHeader_RequestScheme
* GSWeb.framework/GSWContext.m/.h:
o fix in -_synchronizeForDistribution
o try to avoid complete URL when we can use relative one
* GSWeb.framework/GSWRequest.m:
o fix to retrieve protocol & port from adaptor headers
* GSWeb.framework/GSWSession.m:
o fix in -appendCookieToResponse:
* GSAdaptors/Apache/mod_gsweb.c:
o fix for server port header
2003-04-05 Manuel Guesdon <mguesdon@orange-concept.com> 2003-04-05 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWAdaptors/common/config.h: * GSWAdaptors/common/config.h:
o change minor version o change minor version

View file

@ -362,9 +362,20 @@ copyHeaders(request_rec *p_pRequestRec,
g_szServerInfo_ServerName, g_szServerInfo_ServerName,
pServerRec->server_hostname); pServerRec->server_hostname);
pszPort = APR_PSPRINTF(p_pRequestRec->pool, {
"%u", unsigned int serverPort=(unsigned)ap_get_server_port(p_pRequestRec);
pServerRec->port); if (serverPort==0)
{
if (p_pRequestRec->parsed_uri.port_str && p_pRequestRec->parsed_uri.port!=0)
serverPort=(unsigned)p_pRequestRec->parsed_uri.port;
else
serverPort=(unsigned)pServerRec->port;
};
pszPort = APR_PSPRINTF(p_pRequestRec->pool,
"%u",
(unsigned int)serverPort);
};
GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest, GSWHTTPRequest_AddHeader(p_pGSWHTTPRequest,
g_szServerInfo_ServerPort, g_szServerInfo_ServerPort,
pszPort); pszPort);

View file

@ -12,7 +12,7 @@ ApplicationNameString: GSWString
ReenterHyperlink: GSWHyperlink ReenterHyperlink: GSWHyperlink
{ {
pageName = "Main"; pageName = "";
target = "_top"; target = "_top";
}; };

View file

@ -12,6 +12,6 @@ ApplicationNameString: GSWString
ReenterHyperlink: GSWHyperlink ReenterHyperlink: GSWHyperlink
{ {
pageName = "Main"; pageName = "";
target = "_top"; target = "_top";
} }

View file

@ -449,8 +449,8 @@ int GSWApplicationMainReal(NSString* applicationClassName,
}; };
}; };
}; };
NSDebugFLLog(@"bundles",@"[NSBundle allBundles]=%@",[NSBundle allBundles]); NSDebugFLLog(@"bundles",@"[NSBundle allBundles] pathes=%@",[[NSBundle allBundles] valueForKey:@"resourcePath"]);
NSDebugFLLog(@"bundles",@"[NSBundle allFrameworks]=%@",[NSBundle allFrameworks]); NSDebugFLLog(@"bundles",@"[NSBundle allFrameworks] pathes=%@",[[NSBundle allFrameworks] valueForKey:@"resourcePath"]);
}; };
if (result>=0) if (result>=0)
{ {
@ -480,7 +480,9 @@ int GSWApplicationMainReal(NSString* applicationClassName,
if (result>=0 && GSWApp) if (result>=0 && GSWApp)
{ {
[GSWApp _setPool:[NSAutoreleasePool new]]; [GSWApp _setPool:[NSAutoreleasePool new]];
[GSWApp run]; [GSWApp run];
DESTROY(GSWApp); DESTROY(GSWApp);
}; };
GSWLogMemCF("Destroy NSAutoreleasePool: %p",appAutoreleasePool); GSWLogMemCF("Destroy NSAutoreleasePool: %p",appAutoreleasePool);
@ -547,6 +549,13 @@ int GSWApplicationMain(NSString* applicationClassName,
// context=nil;//deprecated // context=nil;//deprecated
_selfLock=[NSRecursiveLock new]; _selfLock=[NSRecursiveLock new];
_globalLock=[NSLock new]; _globalLock=[NSLock new];
NSDebugMLLog(@"application",@"GSCurrentThreadDictionary()=%@",GSCurrentThreadDictionary());
//Do it before run so application can addTimer,... in -run
NSDebugMLLog(@"application",@"[NSRunLoop currentRunLoop]=%@",[NSRunLoop currentRunLoop]);
ASSIGN(_currentRunLoop,[NSRunLoop currentRunLoop]);
_pageCacheSize=30; _pageCacheSize=30;
_permanentPageCacheSize=30; _permanentPageCacheSize=30;
_pageRecreationEnabled=YES; _pageRecreationEnabled=YES;
@ -1262,6 +1271,7 @@ selfLockn,
}; };
if (!componentDefinition) if (!componentDefinition)
{ {
NSLog(@"EXCEPTION: allFrameworks pathes=%@",[[NSBundle allFrameworks] valueForKey:@"resourcePath"]);
ExceptionRaise(GSWPageNotFoundException, ExceptionRaise(GSWPageNotFoundException,
@"Unable to create component definition for %@ for languages: %@ (no componentDefinition).", @"Unable to create component definition for %@ for languages: %@ (no componentDefinition).",
aName, aName,
@ -1369,7 +1379,8 @@ selfLockn,
LOGObjectFnStart(); LOGObjectFnStart();
allFrameworks=[[NSBundle allFrameworks] mutableCopy]; allFrameworks=[[NSBundle allFrameworks] mutableCopy];
[allFrameworks addObjectsFromArray:[NSBundle allBundles]]; [allFrameworks addObjectsFromArray:[NSBundle allBundles]];
// NSDebugMLLog(@"gswcomponents",@"_allFrameworks=%@",_allFrameworks); //NSDebugMLLog(@"gswcomponents",@"allFrameworks=%@",allFrameworks);
//NSDebugFLLog(@"gswcomponents",@"allFrameworks pathes=%@",[allFrameworks valueForKey:@"resourcePath"]);
array=[self lockedInitComponentBearingFrameworksFromBundleArray:allFrameworks]; array=[self lockedInitComponentBearingFrameworksFromBundleArray:allFrameworks];
NSDebugMLLog(@"gswcomponents",@"array=%@",array); NSDebugMLLog(@"gswcomponents",@"array=%@",array);
[allFrameworks release]; [allFrameworks release];
@ -1391,12 +1402,13 @@ selfLockn,
for(i=0;i<[bundles count];i++) for(i=0;i<[bundles count];i++)
{ {
bundle=[bundles objectAtIndex:i]; bundle=[bundles objectAtIndex:i];
// NSDebugMLLog(@"gswcomponents",@"_bundle=%@",_bundle); //NSDebugMLLog(@"gswcomponents",@"bundle=%@",bundle);
//NSDebugMLLog(@"gswcomponents",@"bundle resourcePath=%@",[bundle resourcePath]);
bundleInfo=[bundle infoDictionary]; bundleInfo=[bundle infoDictionary];
// NSDebugMLLog(@"gswcomponents",@"_bundleInfo=%@",_bundleInfo); //NSDebugMLLog(@"gswcomponents",@"bundleInfo=%@",bundleInfo);
hasGSWComponents=[bundleInfo objectForKey:@"HasGSWComponents"]; hasGSWComponents=[bundleInfo objectForKey:@"HasGSWComponents"];
// NSDebugMLLog(@"gswcomponents",@"_hasGSWComponents=%@",_hasGSWComponents); //NSDebugMLLog(@"gswcomponents",@"hasGSWComponents=%@",hasGSWComponents);
// NSDebugMLLog(@"gswcomponents",@"_hasGSWComponents class=%@",[_hasGSWComponents class]); //NSDebugMLLog(@"gswcomponents",@"hasGSWComponents class=%@",[hasGSWComponents class]);
if (boolValueFor(hasGSWComponents)) if (boolValueFor(hasGSWComponents))
{ {
[array addObject:bundle]; [array addObject:bundle];
@ -2324,9 +2336,9 @@ selfLockn,
//call self _openInitialURL //call self _openInitialURL
NSDebugMLLog(@"application",@"GSCurrentThreadDictionary()=%@",GSCurrentThreadDictionary()); NSDebugMLLog(@"application",@"GSCurrentThreadDictionary()=%@",GSCurrentThreadDictionary());
NSDebugMLLog(@"application",@"[NSRunLoop currentRunLoop]=%@",[NSRunLoop currentRunLoop]); NSDebugMLLog(@"application",@"[NSRunLoop currentRunLoop]=%@",[NSRunLoop currentRunLoop]);
ASSIGN(_currentRunLoop,[NSRunLoop currentRunLoop]); NSAssert(_currentRunLoop,@"No runLoop");
NSDebugMLLog(@"application",@"GSCurrentThreadDictionary()=%@",GSCurrentThreadDictionary());
[[NSRunLoop currentRunLoop] run]; [_currentRunLoop run];
NSDebugMLLog0(@"application",@"NSRunLoop end run"); NSDebugMLLog0(@"application",@"NSRunLoop end run");
[_adaptors makeObjectsPerformSelector:unregisterForEventsSEL]; [_adaptors makeObjectsPerformSelector:unregisterForEventsSEL];
@ -2339,7 +2351,7 @@ selfLockn,
-(NSRunLoop*)runLoop -(NSRunLoop*)runLoop
{ {
return _currentRunLoop;//[NSRunLoop currentRunLoop]; return _currentRunLoop;
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View file

@ -115,6 +115,10 @@ extern NSString* GSWHTTPHeader_AuthPass[2];
extern NSString* GSWHTTPHeader_AuthType[2]; extern NSString* GSWHTTPHeader_AuthType[2];
extern NSString* GSWHTTPHeader_DocumentRoot[2]; extern NSString* GSWHTTPHeader_DocumentRoot[2];
extern NSString* GSWHTTPHeader_GatewayInterface[2]; extern NSString* GSWHTTPHeader_GatewayInterface[2];
extern NSString* GSWHTTPHeader_Protocol[2];
extern NSString* GSWHTTPHeader_ProtocolNum[2];
extern NSString* GSWHTTPHeader_RequestScheme[2];
extern NSString* GSWHTTPHeader_Method[2]; extern NSString* GSWHTTPHeader_Method[2];
extern NSString* GSWHTTPHeader_MethodPost; extern NSString* GSWHTTPHeader_MethodPost;
extern NSString* GSWHTTPHeader_MethodGet; extern NSString* GSWHTTPHeader_MethodGet;

View file

@ -123,6 +123,9 @@ NSString* GSWHTTPHeader_AuthPass[2]={ @"x-gsweb-auth-pass", @"x-webobjects-auth-
NSString* GSWHTTPHeader_AuthType[2]={ @"x-gsweb-auth-type", @"x-webobjects-auth-type" }; NSString* GSWHTTPHeader_AuthType[2]={ @"x-gsweb-auth-type", @"x-webobjects-auth-type" };
NSString* GSWHTTPHeader_DocumentRoot[2]={ @"x-gsweb-documentroot", @"x-webobjects-documentroot" }; NSString* GSWHTTPHeader_DocumentRoot[2]={ @"x-gsweb-documentroot", @"x-webobjects-documentroot" };
NSString* GSWHTTPHeader_GatewayInterface[2]={ @"x-gsweb-gateway-interface", @"x-webobjects-gateway-interface" }; NSString* GSWHTTPHeader_GatewayInterface[2]={ @"x-gsweb-gateway-interface", @"x-webobjects-gateway-interface" };
NSString* GSWHTTPHeader_Protocol[2]={ @"x-gsweb-server-protocol", @"x-webobjects-server-protocol" };
NSString* GSWHTTPHeader_ProtocolNum[2]={ @"x-gsweb-server-protocol-num", @"x-webobjects-server-protocol-num" };
NSString* GSWHTTPHeader_RequestScheme[2]={ @"x-gsweb-request-scheme", @"x-webobjects-request-scheme" };
NSString* GSWHTTPHeader_MethodPost=@"POST"; NSString* GSWHTTPHeader_MethodPost=@"POST";
NSString* GSWHTTPHeader_MethodGet=@"GET"; NSString* GSWHTTPHeader_MethodGet=@"GET";

View file

@ -108,6 +108,11 @@
isSecure:(BOOL)isSecure; isSecure:(BOOL)isSecure;
-(GSWDynamicURLString*)componentActionURL; -(GSWDynamicURLString*)componentActionURL;
-(GSWDynamicURLString*)componentActionURLIsSecure:(BOOL)isSecure; -(GSWDynamicURLString*)componentActionURLIsSecure:(BOOL)isSecure;
-(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey
path:(NSString*)requestHandlerPath
queryString:(NSString*)queryString
isSecure:(BOOL)isSecure
port:(int)port;
-(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey -(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey
path:(NSString*)requestHandlerPath path:(NSString*)requestHandlerPath
queryString:(NSString*)queryString; queryString:(NSString*)queryString;

View file

@ -472,6 +472,40 @@ static int dontTraceComponentActionURL=0;
return url; return url;
}; };
//--------------------------------------------------------------------
-(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey
path:(NSString*)requestHandlerPath
queryString:(NSString*)queryString
isSecure:(BOOL)isSecure
port:(int)port
{
//OK
GSWDynamicURLString* url=nil;
GSWRequest* request=[self request];
LOGObjectFnStartCond(dontTraceComponentActionURL==0);
NSDebugMLogCond(dontTraceComponentActionURL==0,
@"generateCompleteURLs=%s",
(_generateCompleteURLs ? "YES" : "NO"));
// Try to avoid complete URLs
if (_generateCompleteURLs
|| (isSecure!=[request isSecure])
|| (port!=0 && port!=[request urlPort]))
url=[self completeURLWithRequestHandlerKey:requestHandlerKey
path:requestHandlerPath
queryString:queryString
isSecure:isSecure
port:port];
else
url=[request _urlWithRequestHandlerKey:requestHandlerKey
path:requestHandlerPath
queryString:queryString];
NSDebugMLogCond(dontTraceComponentActionURL==0,
@"url=%@",url);
LOGObjectFnStopCond(dontTraceComponentActionURL==0);
return url;
};
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey -(GSWDynamicURLString*)urlWithRequestHandlerKey:(NSString*)requestHandlerKey
path:(NSString*)requestHandlerPath path:(NSString*)requestHandlerPath
@ -539,7 +573,7 @@ static int dontTraceComponentActionURL=0;
[url setURLPort:port]; [url setURLPort:port];
NSDebugMLLog(@"low",@"url=%@",url); NSDebugMLLog(@"low",@"url=%@",url);
host=[request urlHost]; host=[request urlHost];
NSAssert(host,@"No host !"); NSAssert1(host,@"No host in request %@",request);
NSDebugMLLog(@"low",@"host=%@",host); NSDebugMLLog(@"low",@"host=%@",host);
[url setURLHost:host]; [url setURLHost:host];
NSDebugMLLog(@"low",@"url=%@",url); NSDebugMLLog(@"low",@"url=%@",url);
@ -688,7 +722,14 @@ static int dontTraceComponentActionURL=0;
[anURL setURLRequestHandlerPath:actionName]; [anURL setURLRequestHandlerPath:actionName];
[anURL setURLQueryString:queryString]; [anURL setURLQueryString:queryString];
*/ */
anURL=[self completeURLWithRequestHandlerKey:GSWDirectActionRequestHandlerKey[GSWebNamingConv]
/* anURL=[self completeURLWithRequestHandlerKey:GSWDirectActionRequestHandlerKey[GSWebNamingConv]
path:actionName
queryString:queryString
isSecure:isSecure
port:0];
*/
anURL=[self urlWithRequestHandlerKey:GSWDirectActionRequestHandlerKey[GSWebNamingConv]
path:actionName path:actionName
queryString:queryString queryString:queryString
isSecure:isSecure isSecure:isSecure
@ -837,16 +878,26 @@ static int dontTraceComponentActionURL=0;
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(void)_synchronizeForDistribution -(void)_synchronizeForDistribution
{ {
//OK int instance=-1;
NSString* sessionID=nil;
BOOL storesIDsInURLs=NO;
BOOL isDistributionEnabled=NO;
LOGObjectFnStart(); LOGObjectFnStart();
if (_session) storesIDsInURLs=[_session storesIDsInURLs];
isDistributionEnabled=[_session isDistributionEnabled];
if (_request)
{ {
//call session storesIDsInURLs [ret 1] instance=[_request applicationNumber];
//call session isDistributionEnabled [ret 0] sessionID=[_request sessionID];
[_url setURLApplicationNumber:[_request applicationNumber]];//OK };
} if (instance<-1
|| (storesIDsInURLs && ! isDistributionEnabled)
|| (sessionID && instance>=0))
instance=[_request applicationNumber];
else else
[_url setURLApplicationNumber:-1];//OK instance=-1;
_urlApplicationNumber = instance;
[_url setURLApplicationNumber:instance];
LOGObjectFnStop(); LOGObjectFnStop();
}; };

View file

@ -312,10 +312,17 @@ RCS_ID("$Id$")
//OK //OK
NSString* anUrl=nil; NSString* anUrl=nil;
BOOL completeUrlsPreviousState=NO; BOOL completeUrlsPreviousState=NO;
BOOL isSecure=[self evaluateCondition:_secure BOOL isSecure=NO;
inContext:context]; BOOL requestIsSecure=[[context request]isSecure];
if (_secure)
isSecure=[self evaluateCondition:_secure
inContext:context];
else
isSecure=requestIsSecure;
// Force complete URLs // Force complete URLs
if (isSecure) if (isSecure!=requestIsSecure)
completeUrlsPreviousState=[context _generateCompleteURLs]; completeUrlsPreviousState=[context _generateCompleteURLs];
anUrl=(NSString*)[context componentActionURLIsSecure:isSecure]; anUrl=(NSString*)[context componentActionURLIsSecure:isSecure];
NSDebugMLLog(@"gswdync",@"anUrl=%@",anUrl); NSDebugMLLog(@"gswdync",@"anUrl=%@",anUrl);
@ -324,7 +331,7 @@ RCS_ID("$Id$")
inContext:context]; inContext:context];
[self _appendFragmentToResponse:response [self _appendFragmentToResponse:response
inContext:context]; inContext:context];
if (isSecure && !completeUrlsPreviousState) if (isSecure!=requestIsSecure && !completeUrlsPreviousState)
[context _generateRelativeURLs]; [context _generateRelativeURLs];
} }
else if (!WOStrictFlag && (_filename || _data)) else if (!WOStrictFlag && (_filename || _data))
@ -478,6 +485,7 @@ RCS_ID("$Id$")
NSString* anUrl=nil; NSString* anUrl=nil;
BOOL completeUrlsPreviousState=NO; BOOL completeUrlsPreviousState=NO;
BOOL isSecure=NO; BOOL isSecure=NO;
BOOL requestIsSecure=NO;
LOGObjectFnStart(); LOGObjectFnStart();
actionString=[self computeActionStringInContext:context]; actionString=[self computeActionStringInContext:context];
@ -486,10 +494,15 @@ RCS_ID("$Id$")
queryDictionary=[self computeQueryDictionaryInContext:context]; queryDictionary=[self computeQueryDictionaryInContext:context];
NSDebugMLLog(@"gswdync",@"queryDictionary=%@",queryDictionary); NSDebugMLLog(@"gswdync",@"queryDictionary=%@",queryDictionary);
isSecure=[self evaluateCondition:_secure requestIsSecure=[[context request]isSecure];
inContext:context]; if (_secure)
// Force complete URLs isSecure=[self evaluateCondition:_secure
if (isSecure) inContext:context];
else
isSecure=requestIsSecure;
// Force complete URLs is secure mode is not the same
if (isSecure!=requestIsSecure)
completeUrlsPreviousState=[context _generateCompleteURLs]; completeUrlsPreviousState=[context _generateCompleteURLs];
anUrl=(NSString*)[context directActionURLForActionNamed:actionString anUrl=(NSString*)[context directActionURLForActionNamed:actionString
@ -497,7 +510,7 @@ RCS_ID("$Id$")
isSecure:isSecure]; isSecure:isSecure];
NSDebugMLLog(@"gswdync",@"anUrl=%@",anUrl); NSDebugMLLog(@"gswdync",@"anUrl=%@",anUrl);
if (isSecure && !completeUrlsPreviousState) if (isSecure!=requestIsSecure && !completeUrlsPreviousState)
[context _generateRelativeURLs]; [context _generateRelativeURLs];
[response appendContentString:anUrl]; [response appendContentString:anUrl];

View file

@ -56,6 +56,7 @@ RCS_ID("$Id$")
NSDebugMLLog(@"requests",@"method=%@",_method); NSDebugMLLog(@"requests",@"method=%@",_method);
ASSIGNCOPY(_httpVersion,aVersion); ASSIGNCOPY(_httpVersion,aVersion);
ASSIGNCOPY(_headers,headers); ASSIGNCOPY(_headers,headers);
//NSLog(@"HEADERS=%@",_headers);
_defaultFormValueEncoding=NSISOLatin1StringEncoding; _defaultFormValueEncoding=NSISOLatin1StringEncoding;
_formValueEncoding=NSISOLatin1StringEncoding; _formValueEncoding=NSISOLatin1StringEncoding;
[self _initCookieDictionary];//NDFN [self _initCookieDictionary];//NDFN
@ -231,10 +232,17 @@ RCS_ID("$Id$")
//NDFN //NDFN
-(NSString*)urlProtocol -(NSString*)urlProtocol
{ {
//TODO
NSString* urlProtocol=[_uri urlProtocol]; NSString* urlProtocol=[_uri urlProtocol];
if (!urlProtocol) if (!urlProtocol)
urlProtocol=GSWProtocol_HTTP; {
urlProtocol=[self headerForKey:GSWHTTPHeader_RequestScheme[GSWebNamingConv]];
if (!urlProtocol)
{
urlProtocol=[self headerForKey:GSWHTTPHeader_RequestScheme[GSWebNamingConvInversed]];
if (!urlProtocol)
urlProtocol=GSWProtocol_HTTP;
};
};
return urlProtocol; return urlProtocol;
}; };
@ -244,9 +252,11 @@ RCS_ID("$Id$")
{ {
NSString* urlHost=[_uri urlHost]; NSString* urlHost=[_uri urlHost];
if (!urlHost) if (!urlHost)
urlHost=[self headerForKey:GSWHTTPHeader_ServerName[GSWebNamingConv]]; {
if (!urlHost) urlHost=[self headerForKey:GSWHTTPHeader_ServerName[GSWebNamingConv]];
urlHost=[self headerForKey:GSWHTTPHeader_ServerName[GSWebNamingConvInversed]]; if (!urlHost)
urlHost=[self headerForKey:GSWHTTPHeader_ServerName[GSWebNamingConvInversed]];
};
return urlHost; return urlHost;
}; };
@ -256,9 +266,11 @@ RCS_ID("$Id$")
{ {
NSString* urlPortString=[_uri urlPortString]; NSString* urlPortString=[_uri urlPortString];
if (!urlPortString) if (!urlPortString)
urlPortString=[self headerForKey:GSWHTTPHeader_ServerPort[GSWebNamingConv]]; {
if (!urlPortString) urlPortString=[self headerForKey:GSWHTTPHeader_ServerPort[GSWebNamingConv]];
urlPortString=[self headerForKey:GSWHTTPHeader_ServerPort[GSWebNamingConvInversed]]; if (!urlPortString)
urlPortString=[self headerForKey:GSWHTTPHeader_ServerPort[GSWebNamingConvInversed]];
};
return urlPortString; return urlPortString;
}; };
@ -268,9 +280,11 @@ RCS_ID("$Id$")
{ {
int port=[_uri urlPort]; int port=[_uri urlPort];
if (!port) if (!port)
port=[[self headerForKey:GSWHTTPHeader_ServerPort[GSWebNamingConv]]intValue]; {
if (!port) port=[[self headerForKey:GSWHTTPHeader_ServerPort[GSWebNamingConv]]intValue];
port=[[self headerForKey:GSWHTTPHeader_ServerPort[GSWebNamingConvInversed]]intValue]; if (!port)
port=[[self headerForKey:GSWHTTPHeader_ServerPort[GSWebNamingConvInversed]]intValue];
};
return port; return port;
}; };
@ -285,7 +299,7 @@ RCS_ID("$Id$")
//NDFN //NDFN
-(BOOL)isSecure -(BOOL)isSecure
{ {
return [[self urlProtocol] isEqualToString:GSWProtocol_HTTPS]; return ([[self urlProtocol] caseInsensitiveCompare:GSWProtocol_HTTPS]==NSOrderedSame);
}; };
//-------------------------------------------------------------------- //--------------------------------------------------------------------

View file

@ -717,20 +717,22 @@ RCS_ID("$Id$")
{ {
NSString* domainForIDCookies=nil; NSString* domainForIDCookies=nil;
NSString* sessionID=nil; NSString* sessionID=nil;
NSDate* anExpireDate=nil;
LOGObjectFnStart(); LOGObjectFnStart();
domainForIDCookies=[self domainForIDCookies]; domainForIDCookies=[self domainForIDCookies];
sessionID=[self sessionID]; sessionID=[self sessionID];
anExpireDate=[NSDate date]; // Expire now
[aResponse addCookie:[GSWCookie cookieWithName:GSWKey_SessionID[GSWebNamingConv] [aResponse addCookie:[GSWCookie cookieWithName:GSWKey_SessionID[GSWebNamingConv]
value:sessionID value:sessionID
path:domainForIDCookies path:domainForIDCookies
domain:nil domain:nil
expires:[self expirationDateForIDCookies] expires:anExpireDate
isSecure:NO]]; isSecure:NO]];
[aResponse addCookie:[GSWCookie cookieWithName:GSWKey_InstanceID[GSWebNamingConv] [aResponse addCookie:[GSWCookie cookieWithName:GSWKey_InstanceID[GSWebNamingConv]
value:@"-1" //TODO value:@"-1"
path:domainForIDCookies path:domainForIDCookies
domain:nil domain:nil
expires:[self expirationDateForIDCookies] expires:anExpireDate
isSecure:NO]]; isSecure:NO]];
LOGObjectFnStop(); LOGObjectFnStop();
@ -744,22 +746,39 @@ RCS_ID("$Id$")
if ([self storesIDsInCookies]) if ([self storesIDsInCookies])
{ {
//TODO VERIFY //TODO VERIFY
NSString* domainForIDCookies=nil; NSString* domainForIDCookies=[self domainForIDCookies];
NSString* sessionID=nil; NSString* sessionID=[self sessionID];
domainForIDCookies=[self domainForIDCookies]; int instance=-1;
sessionID=[self sessionID]; NSDate* anExpireDate=[self expirationDateForIDCookies];
// SessionID cookie
[aResponse addCookie:[GSWCookie cookieWithName:GSWKey_SessionID[GSWebNamingConv] [aResponse addCookie:[GSWCookie cookieWithName:GSWKey_SessionID[GSWebNamingConv]
value:sessionID value:sessionID
path:domainForIDCookies path:domainForIDCookies
domain:nil domain:nil
expires:[self expirationDateForIDCookies] expires:anExpireDate
isSecure:NO]]; isSecure:NO]];
// Instance Cookie
// No Instance if distribution enabled or this session is terminating
if ([self isDistributionEnabled] || [self isTerminating])
{
instance=-1;
anExpireDate=[NSDate date]; //expire now !
}
else
{
GSWRequest* request = [_currentContext request];
if (request)
instance=[request applicationNumber]; // use the request instance number
else
instance=-1;
};
[aResponse addCookie:[GSWCookie cookieWithName:GSWKey_InstanceID[GSWebNamingConv] [aResponse addCookie:[GSWCookie cookieWithName:GSWKey_InstanceID[GSWebNamingConv]
value:@"1" //TODO value:[NSString stringWithFormat:@"%d",instance]
path:domainForIDCookies path:domainForIDCookies
domain:nil domain:nil
expires:[self expirationDateForIDCookies] expires:anExpireDate
isSecure:NO]]; isSecure:NO]];
}; };

View file

@ -80,7 +80,7 @@ RCS_ID("$Id$")
//-------------------------------------------------------------------- //--------------------------------------------------------------------
-(NSString*)description -(NSString*)description
{ {
return [NSString stringWithFormat:@"<%s %p - sessionID=%@ timeOutTime=%f lastAccessTime=%f timeOut=%ld", return [NSString stringWithFormat:@"<%s %p - sessionID=%@ timeOutTime=%@ lastAccessTime=%@ timeOut=%ld",
object_get_class_name(self), object_get_class_name(self),
(void*)self, (void*)self,
_sessionID, _sessionID,