Closed alexdowad closed 2 years ago
Sorry, looks like my analysis of this issue is incorrect. Closing this issue for now. Will re-open if necessary.
After further analysis, it seems that maybe there may actually be an issue here, but it's not what I thought it was. To avoid confusion caused by the incorrect report above, I will open a separate ticket...
If one sets
session.data
, callssession:save()
, then modifiessession.data
and makes it smaller, then callssession:save()
again, the second call tosession:save()
will modify theSet-Cookie
header which was created by the first call. This is fine, but the problem is that if the first call set multiple cookie chunks, and the second call set a smaller number of cookie chunks, some spurious and unwanted chunks which were set by the first call will still remain in theSet-Cookie
header and will bloat the response which is sent to the client.I think something needs to be added here: https://github.com/bungle/lua-resty-session/blob/master/lib/resty/session.lua#L236
The added code might look something like:
If you agree that something like this should be done, I would be happy to work on a PR (including tests).