if (_request == nil) return nil;
/* first look into form values */
- if ((sessionId = [_request formValueForKey:WORequestValueSessionID])) {
+ if ((sessionId = [_request formValueForKey:WORequestValueSessionID])!=nil) {
if ([sessionId length] > 0)
return sessionId;
}
/* now look into the cookies */
- if ((sessionId = [_request cookieValueForKey:[self name]])) {
+ if ((sessionId = [_request cookieValueForKey:[self name]]) != nil) {
if ([sessionId respondsToSelector:@selector(objectEnumerator)]) {
NSEnumerator *e;
e = [(id)sessionId objectEnumerator];
- while ((sessionId = [e nextObject])) {
+ while ((sessionId = [e nextObject]) != nil) {
if ([sessionId length] > 0 && ![sessionId isEqual:@"nil"])
return sessionId;
}
@implementation WORequestHandler
+static BOOL doNotSetCookiePath = NO;
static BOOL perflog = NO;
static Class NSDateClass = Nil;
return 2;
}
+ (void)initialize {
+ NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
+
NSDateClass = [NSDate class];
- perflog = [[NSUserDefaults standardUserDefaults]
- boolForKey:@"WOProfileRequestHandler"];
+ perflog = [ud boolForKey:@"WOProfileRequestHandler"];
+ doNotSetCookiePath = [ud boolForKey:@"WOUseGlobalCookiePath"];
}
- (id)init {
if ((self = [super init])) {
- if ([[[NSUserDefaults standardUserDefaults]
- objectForKey:@"WORunMultithreaded"]
- boolValue]) {
+ NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
+
+ if ([ud boolForKey:@"WORunMultithreaded"])
self->lock = [[NSRecursiveLock alloc] init];
- }
}
return self;
}
[[session retain] autorelease];
- if (response)
+ if (response != nil)
/* some kind of error response from above ... */
goto responseDone;
session:session
application:app];
- session = ([context hasSession])
+ session = [context hasSession]
? [context session]
: nil;
- if (session) {
+ if (session != nil) {
if ([session storesIDsInCookies]) {
+ [self logInfoWithFormat:@"add cookie to session: %@", session];
[self addCookiesForSession:session
toResponse:response
inContext:context];
withResponse:response
application:app];
}
+ else
+ [self logInfoWithFormat:@"no session to store."];
}
NS_HANDLER {
response = [app handleException:localException inContext:context];
app = [WOApplication application];
cookieName = [app name];
- {
+ if (!doNotSetCookiePath) {
NSString *tmp;
if ((uri = [[_ctx request] applicationName]) == nil)
uri = [app name];
uri = [@"/" stringByAppendingString:uri];
-
if ((tmp = [[_ctx request] adaptorPrefix]))
uri = [tmp stringByAppendingString:uri];
}
-
+ else
+ uri = @"/";
+
#if 0
uri = [_ctx urlSessionPrefix];
uri = [_ctx urlWithRequestHandlerKey:
[_app saveSessionForContext:_ctx];
/* store response if strange double-click browser */
- if (_response) {
+ if (_response != nil) {
if ([[_ctx request] isDoubleClickBrowser]) {
NSArray *hack; /* 0: uri, 1: response */