You can set a cookie by setting the Set-Cookie key in the
r->headers_out or r->err_headers_out tables (in case your request_rec
structure is called r).

Something like this

static int some_hook(request_rec *r) {
    ...
    apr_table_set(r->headers_out, "Set-Cookie",
"WhateverYouWantToStoreInTheCookie");
    ...
}

For reading the cookie, read the contents of the "Cookie" key in the
r->headers_in table:

    char *cookie = apr_table_get(r->headers_in, "Cookie");


I hope that helps,

-- 
César L. B. Silveira


On Wed, Jun 18, 2008 at 10:58 PM, Sam Carleton
<[EMAIL PROTECTED]> wrote:
> On Wed, Jun 18, 2008 at 9:42 PM, Sam Carleton
> <[EMAIL PROTECTED]> wrote:
>> I am looking for an example of setting a cookie in an apache module.
>> I found mod_auth_memcookie, but it only reads in cookies, it looks
>> like it relies on the php code to actually set the cookie.
>
> I forgot to add that the cookie that is set is going to be used as the
> session ID in the PHP code that is ultimately to handle the request
> once it has been OKed by the ap_hook_auth_checker code.
>
> Sam
>

Reply via email to