Welcome! Log In Create A New Profile

Advanced

Extract individual cookie from multiple cookies

March 04, 2011 09:58AM
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
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Extract individual cookie from multiple cookies

getshirish22 March 04, 2011 09:58AM

Re: Extract individual cookie from multiple cookies

Maxim Dounin March 05, 2011 04:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 246
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready