perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yperl <yp...@club-internet.fr>
Subject Re: Modperl2 + PerlAccessHandler + Sending Cookie
Date Sat, 11 Mar 2006 01:42:20 GMT
Hi there!

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.

Here is my http.conf dealing with that:

------------------------------------------ Mod_perl2 Apache Conf Begin 
-------------------------------------

<Location /gdlweb/resolver>
      SetHandler modperl
      PerlAccessHandler       Login          <--- handler I'm interested in
      PerlResponseHandler  Dispatcher
      PerlOptions +GlobalRequest
</Location>

------------------------------------------ Mod_perl2 Apache Conf End 
-------------------------------------

My Login.pm :

------------------------------------------ Handler Code Begin 
-------------------------------------
sub handler {

  my ( $r ) = @_;

  # some code to create a correct cookie with CGI::Cookie
  my  $cookie   = ....;

  if ( grantAccess() ) {

      $r->headers_out->{'Set-Cookie'} = $cookie;
      return Apache2::Const::OK;
  }

 return Apache2::Const::FORBIDDEN;
}
------------------------------------------ Handler Code End 
-------------------------------------

Any suggestion are very welcome at this point.
Thanks in advance guys (especially Fred).

Younes



yperl@club-internet.fr a écrit :
> I'm generating the cookie with CGI::Cookie().
>
> I think the problem is elsewhere
>
> >From a PerlResponseHandler, the method I described works,
> but I got the problem within a PerlAccessHandler.
>
> Should I delegate the cookie generation to the PerlResponseHandler ?
>
> Younes
>
>
> ---Message d'origine----
>   
>> Date: Fri, 10 Mar 2006 09:04:58 -0800 (PST)
>> Sujet: Re: Re: Modperl2 question
>> De: "Fred Moyer" <fred@taperfriendlymusic.org>
>> A: yperl@club-internet.fr
>> Copie à: modperl@perl.apache.org
>>     
>
>   
>> There's a few recipes here:
>> http://perl.apache.org/docs/2.0/user/coding/cooking.html#Sending_Cookies_Using_libapreq2
>>     
>
>   
>> How are you generating $cookie. You'll likely want to add the cookie in
>> any case, to update certain values or timestamps, I can't think of a case
>> where I haven't done so. You may want to look at Apache2::AuthCookie
>> which is a fully functional module to do exactly this
>>     
>
>
> ----Message d'origine----
>   
>> De: yperl@club-internet.fr
>> A: yperl@club-internet.fr
>> Sujet: Modperl2 + PerlAccessHandler + Sending Cookie
>> Date: Fri, 10 Mar 2006 18:06:23 +0100
>>
>> Hi All!
>>
>> I'm wondering if there is a correct way to send a cookie in a PerlAccessHandler.
>>
>> I've tried something like:
>> $r->headers_out->add('Set-Cookie' => $cookie);
>> and even:
>> $r->err_headers_out->add('Set-Cookie' => $cookie);
>>
>> whithout success
>>
>> I would like to send the cookie if it doesn't exists and 
>> leave in the request if it already exists.
>>
>> Any idea?
>>
>> Thanks
>> Younes
>>
>>     
>
>   


Mime
View raw message