You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by whut_jia <wh...@163.com> on 2010/09/19 16:00:40 UTC

add cookie in handler process

Hello,
I am new to apache module development,and now I have a problem.
Now,I am writing a handler module.In this module,I need validate username/password infomation sent by user.After validating,I set cookie into headers_out(apr_table_set(r->headers_out,"Ser-Cookie","....")),and then do external redirection (apr_table_setn(r->headers_out,"Location"," URL")).The question is that I just get Location header but get Cookie header when I access to apache server.why??
Many thanks,
Jia

Re:Re: add cookie in handler process

Posted by whut_jia <wh...@163.com>.
I want to ask what kind of relationship between external redirect and subrequest ??

Thanks,

Jia

Re: add cookie in handler process

Posted by Issac Goldstand <ma...@beamartyr.net>.
 Because a redirect isn't considered a "normal" (eg, 200) response, so
it uses the err_headers table on output.

Issac

On 9/20/2010 3:49 AM, whut_jia wrote:
> Thank you,According to your ways,I use r->err_headers_out .The question is resolved! But I want ask why?Why did I can't set cookie directly in the main request r->headers_out??
> Thanks,
> Jia  
>
>
>
>
> At 2010-09-20 02:09:54��"Sorin Manolache" <so...@gmail.com> wrote:
>
>> 2010/9/19 whut_jia <wh...@163.com>:
>>> Hello,
>>> I am new to apache module development,and now I have a problem.
>>> Now,I am writing a handler module.In this module,I need validate username/password infomation sent by user.After validating,I set cookie into headers_out(apr_table_set(r->headers_out,"Ser-Cookie","....")),and then do external redirection (apr_table_setn(r->headers_out,"Location"," URL")).The question is that I just get Location header but get Cookie header when I access to apache server.why??
>>> Many thanks,
>>> Jia
>> Use r->err_headers_out


Re:Re: add cookie in handler process

Posted by whut_jia <wh...@163.com>.
Thank you,According to your ways,I use r->err_headers_out .The question is resolved! But I want ask why?Why did I can't set cookie directly in the main request r->headers_out??
Thanks,
Jia  




At 2010-09-20 02:09:54,"Sorin Manolache" <so...@gmail.com> wrote:

>2010/9/19 whut_jia <wh...@163.com>:
>> Hello,
>> I am new to apache module development,and now I have a problem.
>> Now,I am writing a handler module.In this module,I need validate username/password infomation sent by user.After validating,I set cookie into headers_out(apr_table_set(r->headers_out,"Ser-Cookie","....")),and then do external redirection (apr_table_setn(r->headers_out,"Location"," URL")).The question is that I just get Location header but get Cookie header when I access to apache server.why??
>> Many thanks,
>> Jia
>
>Use r->err_headers_out

Re: add cookie in handler process

Posted by Sorin Manolache <so...@gmail.com>.
2010/9/19 whut_jia <wh...@163.com>:
> Hello,
> I am new to apache module development,and now I have a problem.
> Now,I am writing a handler module.In this module,I need validate username/password infomation sent by user.After validating,I set cookie into headers_out(apr_table_set(r->headers_out,"Ser-Cookie","....")),and then do external redirection (apr_table_setn(r->headers_out,"Location"," URL")).The question is that I just get Location header but get Cookie header when I access to apache server.why??
> Many thanks,
> Jia

Use r->err_headers_out

Re: add cookie in handler process

Posted by Ben Noordhuis <in...@bnoordhuis.nl>.
2010/9/19 whut_jia <wh...@163.com>:
> The question is that I just get Location header but get Cookie header when I access to apache server.why??

Not sure what the question is. Do you mean that the response contains
a Location header but no Set-Cookie header? If so, you probably need
to use apr_table_add() instead of apr_table_set().