Can someone please point me to the Firefox source code where Set-Cookie header is parsed? I want to understand the exact behavior.

Read further if you want to know why?
For various constraint in my application, I need to pass multiple cookies inside single Set-Cookie header. RFC-2109 clearly mentions,

> 
> "Set-Cookie response header comprises the token Set-Cookie:, followed by a comma-separated list of one or more cookies. Each cookie begins with a NAME=VALUE pair, followed by zero or more semi-colon-separated attribute-value pairs."
> 
> 
> 

So I should be able to pass following Set-Cookie header

Set-Cookie: name1=value1; attr11=attrval11; attr12=attrval12,name2=value2; attr21=attrval21; attr22=attrval22;

It doesn't work. However, following does work

Set-Cookie: name1=value1, name2=value2; attr1=attrval1; attr2=attrval2;

And, I want to give different attributes for different cookies.

[Update]

*Real Examples*:

Example#1-

Set-Cookie: cookie1=value1; Path=/,cookie2=value2; Path=/

In this case firefox parses and gets first cookie(whose name is "cookie1" and value is "value1") out of it(second one is completely ignored)

Example#2-

Set-Cookie: cookie1=value1,cookie2=value2; Path=/

In this case firefox believes there is one cookie whose name is "cookie1" and value is "value1,cookie2=value2". This, again, is not what was intended.