cloudflare / lua-resty-cookie

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

How to get various cookie's attributes? #11

Open didip opened 8 years ago

didip commented 8 years ago

E.g. Expires, Max-Age, Domain...

Basically, I need the opposite of local function bake(cookie). Parse the cookie string and returns me cookie object.

calio commented 8 years ago

If I understand correctly, you want to parse "Set-Cookie" header and test attributes? Can you tell me more about the use case?

didip commented 8 years ago

I guess I was thinking in terms of Tomcat's jsessionid or Rails cookie secret, where various metadata about the cookie and the content is serialized in the cookie securely.

I am not sure if that's beyond the scope of this library, if so, feel free to close this ticket.

calio commented 8 years ago

If they have the same format as Set-Cookie, then I think it's still in the scope.

didip commented 8 years ago

That would be great! The interface should mirror the bake() function.

Essentially, if there's an unbake() function, it will deserialize and return a table containing cookie metadata, e.g. max-age.