Hi Geoffrey !
Nothing's wrong.

I think that happens because I'm using a bleding edge Apache 2.2.0, mod_perl from svn, Perl 5.8.8 ...
I preferer put double checks in my getCookie() to deal with both situations.

I know that Cookie is a request header, but this is the uniq solution I found after 2 days of investigations. If you've more elegant solution, I'll try it imediatly.

Hope this strange behaviour appears only on my box 8-)

/cheers
Younes

Geoffrey Young a écrit :
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


Reply via email to