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 Neil Erdwien <ne...@k-state.edu> on 2010/09/15 18:34:18 UTC
cookie handling functions
I'm writing a filter module that needs to inspect cookie values sent
with the request.
Getting the cookie string is easy via:
char *s = apr_table_get(r->headers_in, "cookie");
However, this returns the whole cookie string, i.e., something like:
name=value; name="value"; name="quoted \"value\""
Possibly with $Version, $Path, etc. RFC 2965 is the spec.
I can write code to parse that out, but...
1. It is tedious.
2. Surely this has been done. Are there functions somewhere inside
Apache HTTPD, and accessible from a filter, that will do something like:
char *value = get_cookie(r, "cookiename");
3. Whatever is already coded will probably more faithfully implement
the RFC than what I cook up.
--
Neil Erdwien, neil@k-state.edu, 785-532-4905
Web Technologies Manager
Office of Mediated Education, Kansas State University
Re: cookie handling functions
Posted by Neil Erdwien <ne...@k-state.edu>.
Excellent -- this is exactly what I was looking for. I've set it up and
it works great.
BTW, pay attention when it says to use gmake on Solaris. :-)
Thanks.
On 9/15/2010 11:46 AM, Brian McQueen wrote:
> I think apreq has that. If you don't have it already, get it and
> you'll be glad you did. Look at its header files. Lots of good stuff
> in them.
>
> On Wed, Sep 15, 2010 at 9:34 AM, Neil Erdwien<ne...@k-state.edu> wrote:
>> I'm writing a filter module that needs to inspect cookie values sent with
>> the request.
>>
>> Getting the cookie string is easy via:
>>
>> char *s = apr_table_get(r->headers_in, "cookie");
>>
>> However, this returns the whole cookie string, i.e., something like:
>>
>> name=value; name="value"; name="quoted \"value\""
>>
>> Possibly with $Version, $Path, etc. RFC 2965 is the spec.
>>
>> I can write code to parse that out, but...
>>
>> 1. It is tedious.
>>
>> 2. Surely this has been done. Are there functions somewhere inside Apache
>> HTTPD, and accessible from a filter, that will do something like:
>>
>> char *value = get_cookie(r, "cookiename");
>>
>> 3. Whatever is already coded will probably more faithfully implement the
>> RFC than what I cook up.
>>
>> --
>> Neil Erdwien, neil@k-state.edu, 785-532-4905
>> Web Technologies Manager
>> Office of Mediated Education, Kansas State University
>>
--
Neil Erdwien, neil@k-state.edu, 785-532-4905
Web Technologies Manager
Office of Mediated Education, Kansas State University
Re: cookie handling functions
Posted by Brian McQueen <mc...@gmail.com>.
I think apreq has that. If you don't have it already, get it and
you'll be glad you did. Look at its header files. Lots of good stuff
in them.
On Wed, Sep 15, 2010 at 9:34 AM, Neil Erdwien <ne...@k-state.edu> wrote:
> I'm writing a filter module that needs to inspect cookie values sent with
> the request.
>
> Getting the cookie string is easy via:
>
> char *s = apr_table_get(r->headers_in, "cookie");
>
> However, this returns the whole cookie string, i.e., something like:
>
> name=value; name="value"; name="quoted \"value\""
>
> Possibly with $Version, $Path, etc. RFC 2965 is the spec.
>
> I can write code to parse that out, but...
>
> 1. It is tedious.
>
> 2. Surely this has been done. Are there functions somewhere inside Apache
> HTTPD, and accessible from a filter, that will do something like:
>
> char *value = get_cookie(r, "cookiename");
>
> 3. Whatever is already coded will probably more faithfully implement the
> RFC than what I cook up.
>
> --
> Neil Erdwien, neil@k-state.edu, 785-532-4905
> Web Technologies Manager
> Office of Mediated Education, Kansas State University
>