perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <ge...@modperlcookbook.org>
Subject Re: Modperl2 + PerlAccessHandler + Sending Cookie
Date Sat, 11 Mar 2006 13:29:43 GMT


yperl wrote:
> Finally I come with a working solution.
> 
> sub getCookie {
> 
>  my ( $r ) = @_;
> 
>  # check for both 'Cookie' and 'Set-Cookie' HTTP headers
>  return $r->headers_in->{'Cookie'} || $r->headers_in->{'Set-Cookie'};
> }

but that's just wrong :)

Set-Cookie is a response header, so it will be set in $r->headers_out when
the server decides to send a cookie to the client.  Cookie is a request
header, so you glean it from $r->headers_in if the client has one to give
you.  you'll never see Set-Cookie in $r->headers_in unless someone has made
a grave mistake.

you can see the gory details in the rfc

  http://www.ietf.org/rfc/rfc2109.txt

HTH

--Geoff

Mime
View raw message