httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "César Leonardo Blum Silveira" <cesa...@gmail.com>
Subject Re: setting cookies & ap_hook_check_user_id vs ap_hook_auth_checker
Date Fri, 20 Jun 2008 20:17:18 GMT
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
<scarleton@miltonstreet.com> wrote:
> On Wed, Jun 18, 2008 at 9:42 PM, Sam Carleton
> <scarleton@miltonstreet.com> 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
>

Mime
View raw message