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:
Adam Fedor 2010-03-14 19:05:57 +00:00
parent 31db332e47
commit c2b8427723
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>
* configure.ac: Note use of nonfragile abi

View file

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