Hi.
A Set-Cookie HTTP header looks like this:
Set-Cookie: sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT
The value of the header contains several name=value fields, separated by semicolons (;) . My application had that header value string formatted at some point, and afterwards it sets the header on the HTTP server using x.Web.setHeader. It worked fine until I had to use setCookie instead. Now I have to do something like this:
x.Web.setCookie("sessionToken", "abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT");
The neko.Web.setCookie does not percent-encode the value of the cookie, and the client's browser parses all the fields correctly. But the php.Web.setCookie, that uses the PHP function setcookie, sends the header like this:
Set-Cookie: sessionToken=abc123%3B%20Expires%3DWed%2C%2009%20Jun%202021%2010%3A18%3A14%20GMT
Having the entire second argument percent-encoded, the client's browser is unable to parse the Expires field, in this example. As you suggested, I tried using the PHP setrawcookie function, but it raises an exception.
I have managed to break my already formatted header value string into
several arguments for the x.Web.setCookie Haxe method, which fixed the problem for Neko and PHP. So, I'm not in a hurry at the moment. However, a better solution would be appreciated. It would be great to have a low level method for header adding instead of setting.
Thanks for your time. :)