cloudflare / lua-resty-cookie

Lua library for HTTP cookie manipulations for OpenResty/ngx_lua
347 stars 160 forks source link

New method to get all cookies including multiple cookies with same name #23

Closed chandu-atina closed 1 year ago

chandu-atina commented 6 years ago

Added new method get_all_as_list to retrieve cookies as a lua table list of cookies from HTTP request including multiple cookies with same name.

An HTTP request can have multiple cookies with same name when they have different PATH or different DOMAIN(a sub domain). For e.g. Cookies created by example.com domain will be accessible to test.example.com

Cookie #1 : name="SAMPLE", value="ABC", path ="/", domain="example.com"
Cookie #2 : name="SAMPLE", value="XYZ", path ="/account", domain="example.com"

Cookie #1 : name="SAMPLE", value="ABC", path ="/", domain="test.example.com"
Cookie #2 : name="SAMPLE", value="XYZ", path ="/", domain="example.com" 

The existing get_all will override the previous cookie value with the latest value when we have multiple cookies with same name.

There is some duplication of code as I don't want to disturb the existing functionality and also to maintain backward compatibility.

Let me know your thoughts on this so that I can add test cases for the new method.

chandu-atina commented 6 years ago

@calio Can you have a look into PR

chandu-atina commented 6 years ago

@agentzh Can you shower your thoughts on this PR ?

chandu-atina commented 6 years ago

@calio Who is maintaining the repo now ?

maurizioabba commented 1 year ago

Seeing this now. Assuming fine to close, please reopen if interested