Multiple Set-Cookie values in response


We are currently trying to set multiple Set-Cookie HTTP response headers in a single response. But we have noticed that Sparkle does not work with this. Only 1 cookie value gets send back by Sparkle.

For example, this is what we are trying to do when building a response:


So that with every new request the browser will send these cookies:

Cookiefoo_cookie=foo; bar_cookie=bar

The current behavior with the example above is that only the last SetValue will be send back (in this case: bar_cookie=bar)

How can we achieve multiple Set-Cookie values in a single response with Sparkle? 
Thank you.

You can separate the values using a #10 character:

C.Response.Headers.SetValue('Set-Cookie', '"foo_cookie=foo"'#10'"bar_cookie=bar"' );

Or if you prefer a more generic way:

  ExistingHeader := C.Response.Headers.Get('Set-Cookie');
  if ExistingHeader <> '' then
    ExistingHeader := ExistingHeader + #10;
  ExistingHeader := ExistingHeader + Cookie;
  C.Response.Headers.SetValue('Set-Cookie', ExistingHeader);