perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "cfaust-dougot" <cfa...@doyougot.com>
Subject RE: Apache2::Cookie/APR::Request::Cookie
Date Sat, 09 Dec 2006 17:09:46 GMT
Thanks Clinton,John and Philip.. Everything is helpful.
 
Can I ask if there is something different when redirecting? It would appear the cookie isn't
being sent in a redirect.
 
When logging in from the post form I see the "Set-Cookie" header being set but when I redirect
them back to the URl they should be on I don't see the "Set-Cookie" header being set even
though I pack up the cookie and set it again (just like in the previous POST request)
 
But does that even matter? A cookie isn't always set before its read in the same session,
I might be looking for a cookie that was saved the last time you were on the site.
 
Thanks
-Chris

________________________________

From: Clinton Gormley [mailto:clint@traveljury.com]
Sent: Sat 12/9/2006 11:07 AM
To: cfaust-dougot
Cc: modperl@perl.apache.org
Subject: RE: Apache2::Cookie/APR::Request::Cookie




> After the cookie has been set...
> 
> my $req = APR::Request::Apache2->handle( $r );
> my $jar = $req->jar;
> print $req->jar_status();
> 
> Just gives me the error of "Missing Input Data" and I'm sure apreq2 is
> loaded.

from what John said:

> jar() returns undef if the browser sent no Cookie header - hence
> "can't call get method on undefined".

it sounds like your cookie isn't being sent by your browser back to your
web server.  i remember having some problems with the parameters I was
passing to the cookie.  Try just setting name and value and see what
happens there.

Also, check what headers your browser is sending back.  (The LiveHeader
add-on in firefox will do this for you)
> 
> Man, I wish getting rid of CGI.pm was as easy as using it :) - Back to
> the drawing board!!
> 
> Thanks
> -Chris
>
> 
>
> ______________________________________________________________________
> From: Clinton Gormley [mailto:clint@traveljury.com]
> Sent: Sat 12/9/2006 10:00 AM
> To: cfaust-dougot
> Cc: modperl@perl.apache.org
> Subject: RE: Apache2::Cookie/APR::Request::Cookie
>
>
> On Sat, 2006-12-09 at 09:37 -0500, cfaust-dougot wrote:
> > Thanks for the reply Clinton, I was just using the same request obj
> > from the handler, guess that was wrong :)
> >
> > I tried your read example and now I don't get anything at all (even
> > though I can see the cookie on the machine)
>
> What do you mean by 'I can see the cookie on the machine'?
>
> Can you see in the browser that it is being set?
>
>
> >
> >         my $req = APR::Request::Apache2->handle( $r );
> >         my $jar = $req->jar;
>
> Try : print $req->jar_status();
> and see : perldoc APR::Request
>
> >         my %cookies;
> >         foreach my $key ( keys %$jar ) {
> >             print "Key is $key and value is " . $jar->get($key);
> >    $cookies{$key} = $jar->get($key);
> >         }
> >
> > And if I do just this
> >
> >         my $req = APR::Request::Apache2->handle( $r );
> >         my $jar = $req->jar;
> >   my $cookie = $jar->get('ISMH_SESSION_ID');
> >
> > I get the error of "Can't call method "get" on an undefined value"
> >
> > If it matters, I load the modules in my startup.pl
> > use Apache2::Request ();
> > use Apache2::RequestRec ();
> > use Apache2::Cookie ();
> > use Apache2::Const -compile => qw(REDIRECT);
> > use Apache2::Const -compile => qw(OK);
> > use APR::Table ();
> > use APR::Request ();
> > use APR::Request::Cookie ();
> >
> > Am I doing anything that is clearly wrong?
>
> Not to me, but it is too long since I wrote my code to remember the
> issues I had. I remember it took me a while to get it write.
>
> Here is what I use at the top of my module:
> use APR::Request qw/encode decode/;
> use APR::Request::Apache2();
> use APR::Request::Param();
> use APR::Request::Cookie();
> use APR::Table();
>
> Are you sure that libapreq is correctly installed?  Did you run make
> test?  Is it loaded in your httpd.conf file?
>
> I'm clutching at straws....
>
> good luck
>
> clint
>
>
>
>
>

________________________________________________________________________

Clinton Gormley clinton@traveljury.com

www.TravelJury.com - For travellers, By travellers






Mime
View raw message