Correct format syntax

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29954 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 2010-03-14 19:05:57 +00:00
parent 03d97355c0
commit b6b9375f4d
2 changed files with 24 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2010-03-14 Adam Fedor <fedor@mallory>
* Source/NSHTTPCookie.m (+requestHeaderFieldsWithCookies:):
Correct format syntax.
2010-03-13 Richard Frith-Macdonald <rfm@gnu.org> 2010-03-13 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: Note use of nonfragile abi * configure.ac: Note use of nonfragile abi

View file

@ -183,7 +183,8 @@ static NSRange GSRangeOfCookie(NSString *string);
if ([dict objectForKey: NSHTTPCookieDomain] == nil) if ([dict objectForKey: NSHTTPCookieDomain] == nil)
[dict setObject: defaultDomain forKey: NSHTTPCookieDomain]; [dict setObject: defaultDomain forKey: NSHTTPCookieDomain];
cookie = [NSHTTPCookie cookieWithProperties: dict]; cookie = [NSHTTPCookie cookieWithProperties: dict];
[a addObject: cookie]; if (cookie)
[a addObject: cookie];
} }
if ([field length] <= NSMaxRange(range)) if ([field length] <= NSMaxRange(range))
break; break;
@ -231,7 +232,7 @@ static NSRange GSRangeOfCookie(NSString *string);
while ((ck = [ckenum nextObject])) while ((ck = [ckenum nextObject]))
{ {
NSString *str; NSString *str;
str = [NSString stringWithFormat: @"$@=$@", [ck name], [ck value]]; str = [NSString stringWithFormat: @"%@=%@", [ck name], [ck value]];
if (field) if (field)
field = [field stringByAppendingFormat: @"; %@", str]; field = [field stringByAppendingFormat: @"; %@", str];
else else
@ -273,18 +274,28 @@ static NSRange GSRangeOfCookie(NSString *string);
return [this->_properties objectForKey: NSHTTPCookieExpires]; return [this->_properties objectForKey: NSHTTPCookieExpires];
} }
- (BOOL) _isValidProperty: (NSString *)prop
{
return ([prop length]
&& [prop rangeOfString: @"\n"].location == NSNotFound);
}
- (id) initWithProperties: (NSDictionary *)properties - (id) initWithProperties: (NSDictionary *)properties
{ {
NSMutableDictionary *rawProps; NSMutableDictionary *rawProps;
if ((self = [super init]) == nil) if ((self = [super init]) == nil)
return nil; return nil;
/* Parse a few values. Based on Mac OS X tests. /* Check a few values. Based on Mac OS X tests. */
FIXME: Probably needs more checking. */ if (![self _isValidProperty: [properties objectForKey: NSHTTPCookiePath]]
if ([properties objectForKey: NSHTTPCookiePath] == nil) || ![self _isValidProperty: [properties objectForKey: NSHTTPCookieDomain]]
return nil; || ![self _isValidProperty: [properties objectForKey: NSHTTPCookieName]]
if ([properties objectForKey: NSHTTPCookieDomain] == nil) || ![self _isValidProperty: [properties objectForKey: NSHTTPCookieValue]]
return nil; )
{
[self release];
return nil;
}
rawProps = [[properties mutableCopy] autorelease]; rawProps = [[properties mutableCopy] autorelease];
if ([rawProps objectForKey: @"Created"] == nil) if ([rawProps objectForKey: @"Created"] == nil)