Extract individual cookie from multiple cookies

shirish deshpande getshirish22 at gmail.com
Fri Mar 4 17:55:46 MSK 2011


Hi,

Am developing an nginx module. I get multiple cookies in a http
request. I need to extract individual cookie from the multiple cookies
that I get. How do I achive this?

Is there an api to extract individual cookie?

>From what I understand:

+ The cookies are present in request->headers_in as array

  cookies == request->headers_in->cookies

+ The length of this array is 1, even when we get multiple cookies.

+ Further investigation reveals that the element is a hash.

  cookies->elts is a hash.

  key   is cookie
  value is all cookies
  eg:
  key -> cookie
  value -> "cookie1=value1;cookie2=value2;cookie3=value3"

+ So will I need to parse the cookie string in "value" to extract
  individual cookies?

  Or is there a api that will help in extract individual cookies.

+ I cannot use ngx_http_parse_multi_header_lines() as I may not always
  know the name of the cookie (the cookie name may vary depending on
  id).
Thanks for your help.

~ s
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20110304/fc1e454a/attachment.html>


More information about the nginx mailing list