perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Moyer <f...@taperfriendlymusic.org>
Subject Re: Modperl2 + PerlAccessHandler + Sending Cookie
Date Sat, 11 Mar 2006 09:46:10 GMT
yperl wrote:
> unfortunately no. I've already tried this.

Sometimes bad cookies leave no crumbs and are especially hard to track 
down.  I'm guessing this has to do with the specifics of your cookie 
values - can you show us the exact code you used to create it?

I was able to successfully bake a cookie from a PerlAccessHandler with 
the following code:

package Cookie::Monster;

use strict;
use warnings;

use Apache2::Const -compile => qw( OK );
use CGI::Cookie;

sub handler {
     my $r = shift;
     my $cookie = new CGI::Cookie( -name => 'ID', -value => 123456 );
     $r->headers_out->add('Set-Cookie' => $cookie );
     return Apache2::Const::OK;
}

1;

httpd.conf

<Location /test>
     SetHandler modperl
     PerlAccessHandler Cookie::Monster
     PerlResponseHandler Apache2::Const::OK
</Location>

Headers output:

GET /test/ HTTP/1.1
Host: localhost:7777
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) 
Gecko/20051201 Firefox/1.0.7
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5


Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: ID=123456
Cache-Control: max-age=0

> 
> Frank Wiles a écrit :
>> On Sat, 11 Mar 2006 02:42:20 +0100
>> yperl <yperl@club-internet.fr> wrote:
>>
>>  
>>> I've tried everything I found (in mailing lists, suggestions, web doc)
>>> to send cookie from a PerlAccessHandler, but without success.
>>>
>>> Before giving up, I would like to have an answer from the mod_perl2 
>>> authors if it is possible.
>>>
>>> [snip]
>>>
>>>   if ( grantAccess() ) {
>>>
>>>       $r->headers_out->{'Set-Cookie'} = $cookie;
>>>       return Apache2::Const::OK;
>>>   }
>>>     
>>
>>   Shouldn't that be:
>>   $r->headers_out->add('Set-Cookie' => $cookie );
>>  ---------------------------------
>>    Frank Wiles <frank@wiles.org>
>>    http://www.wiles.org
>>  ---------------------------------
>>
>>   
> 


Mime
View raw message