From 22e8431103e789facdd21738f3d0a1fb11480944 Mon Sep 17 00:00:00 2001 From: helge Date: Fri, 15 Feb 2008 16:25:08 +0000 Subject: [PATCH] fixed a bug in cookie init, use utf8 git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1605 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 5 +++++ sope-appserver/NGObjWeb/WOCookie.m | 10 ++++++---- sope-appserver/NGObjWeb/WOCoreApplication.m | 1 - 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index b0aaf027..d64ee177 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,8 @@ +2008-02-15 Helge Hess + + * WOCookie.m: fixed bug pointed out by Stephane, use -UTF8String to + decode the cookie (was -cString) (v4.7.21) + 2008-02-05 Helge Hess * DynamicElements/_WOComplexHyperlink.m: use NO, not 'false', as diff --git a/sope-appserver/NGObjWeb/WOCookie.m b/sope-appserver/NGObjWeb/WOCookie.m index 131cc296..492394eb 100644 --- a/sope-appserver/NGObjWeb/WOCookie.m +++ b/sope-appserver/NGObjWeb/WOCookie.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2005 SKYRIX Software AG + Copyright (C) 2000-2008 SKYRIX Software AG This file is part of SOPE. @@ -40,7 +40,9 @@ static NSString *cookieDateFormat = @"%a, %d-%b-%Y %H:%M:%S %Z"; + (id)cookieWithString:(NSString *)_string { /* private method ! */ - return _parseCookie([_string cString], [_string cStringLength]); + const char *utf8 = [_string UTF8String]; + if (utf8 == NULL) return nil; + return _parseCookie(utf8, strlen(utf8)); } + (id)cookieWithName:(NSString *)_name value:(NSString *)_value { @@ -66,13 +68,13 @@ static NSString *cookieDateFormat = @"%a, %d-%b-%Y %H:%M:%S %Z"; expires:(NSDate *)_date isSecure:(BOOL)_secure { - if ((self = [super init])) { + if ((self = [super init]) != nil) { NSZone *z = [self zone]; self->name = [_name copyWithZone:z]; self->value = [_value copyWithZone:z]; self->path = [_path copyWithZone:z]; self->domainName = [_domain copyWithZone:z]; - self->expireDate = [expireDate retain]; + self->expireDate = [_date retain]; // TBD: should be copy? self->onlyIfSecure = _secure; } return self; diff --git a/sope-appserver/NGObjWeb/WOCoreApplication.m b/sope-appserver/NGObjWeb/WOCoreApplication.m index 20ec7c5d..c66d0d49 100644 --- a/sope-appserver/NGObjWeb/WOCoreApplication.m +++ b/sope-appserver/NGObjWeb/WOCoreApplication.m @@ -338,7 +338,6 @@ static NSMutableArray *activeApps = nil; // THREAD else { [self logWithFormat:@"%@: caught:\n %@\nin context:\n %@.", self, _exc, _ctx]; - } if ((r = [WOResponse responseWithRequest:rq]) == nil) -- 2.39.5