mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fix for NSURLResponse does not allow for multiple Set-Cookie headers in the same response #85 ... combine multiple header values as a comma separated list.
This commit is contained in:
parent
6d714c8ee1
commit
05f442de8b
1 changed files with 17 additions and 0 deletions
|
@ -114,12 +114,29 @@ typedef struct {
|
|||
{
|
||||
GSMimeHeader *h;
|
||||
|
||||
/* Remove existing headers matching the ones we are setting.
|
||||
*/
|
||||
e = [(NSArray*)headers objectEnumerator];
|
||||
while ((h = [e nextObject]) != nil)
|
||||
{
|
||||
NSString *n = [h namePreservingCase: YES];
|
||||
|
||||
[this->headers removeObjectForKey: n];
|
||||
}
|
||||
/* Set new headers, joining values where we have multiple headers
|
||||
* with the same name.
|
||||
*/
|
||||
e = [(NSArray*)headers objectEnumerator];
|
||||
while ((h = [e nextObject]) != nil)
|
||||
{
|
||||
NSString *n = [h namePreservingCase: YES];
|
||||
NSString *o = [this->headers objectForKey: n];
|
||||
NSString *v = [h fullValue];
|
||||
|
||||
if (nil != o)
|
||||
{
|
||||
n = [NSString stringWithFormat: @"%@, %@", o, n];
|
||||
}
|
||||
[self _setValue: v forHTTPHeaderField: n];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue