A problem when modifing r->headers_in.cookies

tianfeng spirittf at gmail.com
Sun May 2 07:26:15 MSD 2010


I'm writing a module to add a cookie into r->headers_in.cookies, that the
php-cgi server behind can get it from $_COOKIE. But there's a problem which
I could not resolve.
If there's no cookie sent from client, I just create a new *
r->headers_in.cookies.elts* to store my cookie for php-cgi behind as this:
*ngx_table_elt_t* cookie = (ngx_table_elt_t*)ngx_pcalloc(r->pool,
sizeof(ngx_table_elt_t));
cookie = (ngx_table_elt_t*)ngx_array_push(&r->headers_in.cookies);*
Then I stroe my cookie to *cookie*, but the php-cgi can not get cookie from
$_COOKIE.
However, if client already has cookie and send them to server, I can modify
*r->headers_in.cookies.elts* to add my cookie to it, and the php-cgi behind
can get my cookie from $_COOKIE.
My module is registed in *NGX_HTTP_PREACCESS_PHASE*.
I really don't know how to resolve it[?]. Who can help me? Thank you very
much!![?]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100502/4fa2f749/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 912 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx/attachments/20100502/4fa2f749/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 581 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx/attachments/20100502/4fa2f749/attachment-0001.gif>


More information about the nginx mailing list