Tweka header parsing for http response.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25158 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2007-05-15 08:36:23 +00:00
parent ce98e93c13
commit 428ed5fd0d
4 changed files with 63 additions and 26 deletions

View file

@ -3070,6 +3070,41 @@ static NSCharacterSet *tokenSet = nil;
return desc;
}
/** Returns the full value of the header including any parameters and
* preserving case. This is an unfolded (long) line with no escape
* sequences (ie contains a unicode string not necessarily plain ASCII).<br />
* If you just want the plain value excluding any parameters, use the
* -value method instead.
*/
- (NSString*) fullValue
{
if ([params count] > 0)
{
NSMutableString *m;
NSEnumerator *e;
NSString *k;
m = [value mutableCopy];
e = [params keyEnumerator];
while ((k = [e nextObject]) != nil)
{
NSString *v;
v = [GSMimeHeader makeQuoted: [params objectForKey: k] always: NO];
[m appendString: @"; "];
[m appendString: k];
[m appendString: @"="];
[m appendString: v];
}
k = [m makeImmutableCopyOnFail: YES];
return AUTORELEASE(k);
}
else
{
return value;
}
}
- (id) init
{
return [self initWithName: @"unknown" value: @"none" parameters: nil];
@ -3441,7 +3476,8 @@ static NSCharacterSet *tokenSet = nil;
}
/**
* Returns the value of this header (excluding any parameters)
* Returns the value of this header (excluding any parameters).<br />
* Use the -fullValue m,ethod if you want parameter included.
*/
- (NSString*) value
{