mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Merge branch 'fix-nsurlcomponents' of github.com:gnustep/libs-base into fix-nsurlcomponents
This commit is contained in:
commit
bc0be86d46
1 changed files with 30 additions and 14 deletions
|
@ -2629,23 +2629,39 @@ GS_PRIVATE_INTERNAL(NSURLComponents)
|
||||||
|
|
||||||
- (NSString *) query
|
- (NSString *) query
|
||||||
{
|
{
|
||||||
NSString *query = @"";
|
NSString *result = nil;
|
||||||
NSEnumerator *en = [internal->_queryItems objectEnumerator];
|
|
||||||
NSURLQueryItem *item = nil;
|
|
||||||
|
|
||||||
while ((item = (NSURLQueryItem *)[en nextObject]) != nil)
|
if (internal->_queryItems != nil)
|
||||||
{
|
{
|
||||||
NSString *name = [item name];
|
NSMutableString *query = nil;
|
||||||
NSString *value = [item value];
|
NSURLQueryItem *item = nil;
|
||||||
NSString *itemString = [NSString stringWithFormat: @"%@=%@",name,value];
|
NSEnumerator *en;
|
||||||
|
|
||||||
if ([query length] > 0)
|
en = [internal->_queryItems objectEnumerator];
|
||||||
{
|
while ((item = (NSURLQueryItem *)[en nextObject]) != nil)
|
||||||
query = [query stringByAppendingString: @"&"];
|
{
|
||||||
}
|
NSString *name = [item name];
|
||||||
query = [query stringByAppendingString: itemString];
|
NSString *value = [item value];
|
||||||
|
|
||||||
|
if (nil == query)
|
||||||
|
{
|
||||||
|
query = [[NSMutableString alloc] initWithCapacity: 1000];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[query appendString: @"&"];
|
||||||
|
}
|
||||||
|
[query appendString: name];
|
||||||
|
if (value != nil)
|
||||||
|
{
|
||||||
|
[query appendString: @"="];
|
||||||
|
[query appendString: value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result = AUTORELEASE([query copy]);
|
||||||
|
RELEASE(query);
|
||||||
}
|
}
|
||||||
return query;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _setQuery: (NSString *)query fromPercentEncodedString: (BOOL)encoded
|
- (void) _setQuery: (NSString *)query fromPercentEncodedString: (BOOL)encoded
|
||||||
|
@ -2848,7 +2864,7 @@ GS_PRIVATE_INTERNAL(NSURLComponents)
|
||||||
name = [name _stringByAddingPercentEscapesForQuery];
|
name = [name _stringByAddingPercentEscapesForQuery];
|
||||||
value = [value _stringByAddingPercentEscapesForQuery];
|
value = [value _stringByAddingPercentEscapesForQuery];
|
||||||
ni = [NSURLQueryItem queryItemWithName: name
|
ni = [NSURLQueryItem queryItemWithName: name
|
||||||
value: name];
|
value: value];
|
||||||
[items addObject: ni];
|
[items addObject: ni];
|
||||||
}
|
}
|
||||||
result = AUTORELEASE([items copy]);
|
result = AUTORELEASE([items copy]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue