[ic] Cookie setting refactor

Jon Jensen jon at endpoint.com
Wed Jan 11 16:46:41 UTC 2017


Interchangers,

I'd like any review/input I can get on this minor refactor of the routine 
that builds Set-Cookie headers:

https://github.com/jonjensen/interchange/commit/69c6a24c2377ccb335bda3f1ff90ff636869ea82

The initial impetus for changing it was that it adds multiple ;; and extra 
whitespace in some cases, due to the way it's concatenating strings with 
some conditionals happening and some not.

The extra ; and whitespace didn't break anything because the cookie spec 
is tolerant of extra junk in there, but it made me have to go check and 
test in browsers to be sure.

It's faster (on a microoptimization level) to build up strings in an array 
and join afterwards, which also avoids any extra separators, so I did it 
that way.

This has been running in production at one busy site for a week or so.

Thanks,
Jon

-- 
Jon Jensen
End Point Corporation
https://www.endpoint.com/



More information about the interchange-users mailing list