Re: [mp2] Apache::Cookie
Perrin Harkins <[EMAIL PROTECTED]> writes: > On Tue, 2003-07-15 at 06:43, Swen Schillig wrote: > > Are there any plans to have Apache::Cookie or does > > mp2 code always has to use CGI if there are cookies needed ? > > Apache::Cookie is part of libapreq (along with Apache::Request), so you > should follow libapreq development for this. Now would be an especially good time for the adventurous to try out libapreq-2, since user feedback will accelerate the release process. The preliminary docs for mp2's Apache::Cookie are online at http://httpd.apache.org/~joes/libapreq-2/group__XS__Cookie.html Access to the cvs repository for httpd-apreq-2 is described at the bottom of http://httpd.apache.org/apreq/ -- Joe Schaefer
Re: [mp2] Apache::Cookie
On Tue, 2003-07-15 at 06:43, Swen Schillig wrote: > Are there any plans to have Apache::Cookie or does > mp2 code always has to use CGI if there are cookies needed ? Apache::Cookie is part of libapreq (along with Apache::Request), so you should follow libapreq development for this. - Perrin
Re: [mp2] Apache::Cookie
Swen Schillig wrote: Are there any plans to have Apache::Cookie or does mp2 code always has to use CGI if there are cookies needed ? Apache::Cookie is a part of the libapreq-2 library. It'll become available as soon as Apache::Request is released. You are more then welcome to join the libapreq list and help debug the current version. For more info see: http://httpd.apache.org/apreq/ __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
[mp2] Apache::Cookie
Are there any plans to have Apache::Cookie or does mp2 code always has to use CGI if there are cookies needed ? Swen
RE: Apache::Cookie
Okay, I'm obviously no expert but I see a problem ... I think? : my $cookie = Apache::Cookie->fetch; my $ref_cookie = ref $cookie; returns 'HASH' but my $session = $cookies->{'session'}->value; my $type = ref @session; doesn't return anything, '' or (undef?). strange? However: my @session = $cookies->{'session'}->value; returns the (almost) desired result as pairs and as they were originally inserted from the standard CGI cookie. so i thought it was acceptable to convert to a hash, knowing the list values are in pairs: my %hash = $cookies->{'session'}->value; will probably throw a warning or even an error without the defined statement, but it gets past the immediate issue. kirk >-Original Message- >From: Perrin Harkins [mailto:[EMAIL PROTECTED] >Sent: Tuesday, June 03, 2003 10:57 AM >To: [EMAIL PROTECTED] >Cc: Stas Bekman; modperl >Subject: RE: Apache::Cookie > > >On Tue, 2003-06-03 at 13:08, cap wrote: >> it works just fine in my app, and 'just fine' maybe all that i need. > >The point is, it shouldn't work. You should not be getting a hash. >What should work is this: > >my $session = defined $cookies->{'session'} ? >$cookies->{'session'}->value : undef; > >The larger issue is fixing the Apache::Cookie docs. I would attempt to >patch it if I understood what it's doing. Does anyone know what the API >is returning when you call fetch()? An Apache::Table? Some other kind >of object? It looks pretty bizarre to me, and it certainly isn't doing >what the docs show. > >- Perrin >
RE: Apache::Cookie
On Tue, 2003-06-03 at 13:08, cap wrote: > it works just fine in my app, and 'just fine' maybe all that i need. The point is, it shouldn't work. You should not be getting a hash. What should work is this: my $session = defined $cookies->{'session'} ? $cookies->{'session'}->value : undef; The larger issue is fixing the Apache::Cookie docs. I would attempt to patch it if I understood what it's doing. Does anyone know what the API is returning when you call fetch()? An Apache::Table? Some other kind of object? It looks pretty bizarre to me, and it certainly isn't doing what the docs show. - Perrin
RE: Apache::Cookie
it works just fine in my app, and 'just fine' maybe all that i need. do you have a better solution, or are you just pointing out the error? >-Original Message- >From: Stas Bekman [mailto:[EMAIL PROTECTED] >Sent: Monday, June 02, 2003 10:08 PM >To: [EMAIL PROTECTED] >Cc: Perrin Harkins; modperl >Subject: Re: Apache::Cookie > > >cap wrote: >> Well, here's what I have to do to get direct access to values from the >> original cookie hash: >> >> my $cookies = Apache::Cookie->fetch; >> my %hash = defined $cookies->{'session'} ? $cookies->{'session'}->value : >> undef; >> >> Strange. Thanks for the lead. > >That's a bogus code. Obviously you are running without warnings >mode on. Add: > >use warnings; > >and you will see why it is bogus. Perhaps your cookie was always >valid so you >didn't notice it. Howerer: > >perl -lwe '%h = undef' >Name "main::h" used only once: possible typo at -e line 1. >Odd number of elements in hash assignment at -e line 1. >Use of uninitialized value in list assignment at -e line 1. > > > > >>>-Original Message- >>>From: Perrin Harkins [mailto:[EMAIL PROTECTED] >>>Sent: Monday, June 02, 2003 2:41 PM >>>To: [EMAIL PROTECTED] >>>Cc: modperl >>>Subject: Re: Apache::Cookie >>> >>> >>>On Mon, 2003-06-02 at 09:05, cap wrote: >>> >>>>i have an application that uses CGI and sets the cookie values >>> >>>as a hashref. >>> >>>>im then attempting to retreive the values with Apache::Cookie with: >>>> >>>>$cookies = Apache::Cookie->fetch; >>>> >>>>$ccokies is a hashref so i should be able to get the individual >>> >>>values with: >>> >>>>$cookies->{uid}; >>>> >>>>right? however, this doesn't appear to work. >>> >>>I see the problem. There is mistake in the Apache::Cookie >>>documentation, but the correct way to do this is shown in the mod_perl >>>guide: >>>http://perl.apache.org/docs/1.0/guide/porting.html#Converting_to_us >>>e_Apache_Perl_Modules >>> >>>Change your last line to this: >>> >>>my $uid = defined $cookies->{'uid'} ? $cookies->{'uid'}->value() : >>>undef; >>> >>>- Perrin >>> >> > > >-- > > >__ >Stas BekmanJAm_pH --> Just Another mod_perl Hacker >http://stason.org/ mod_perl Guide ---> http://perl.apache.org >mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com >http://modperlbook.org http://apache.org http://ticketmaster.com > >
Re: Apache::Cookie
cap wrote: Well, here's what I have to do to get direct access to values from the original cookie hash: my $cookies = Apache::Cookie->fetch; my %hash = defined $cookies->{'session'} ? $cookies->{'session'}->value : undef; Strange. Thanks for the lead. That's a bogus code. Obviously you are running without warnings mode on. Add: use warnings; and you will see why it is bogus. Perhaps your cookie was always valid so you didn't notice it. Howerer: perl -lwe '%h = undef' Name "main::h" used only once: possible typo at -e line 1. Odd number of elements in hash assignment at -e line 1. Use of uninitialized value in list assignment at -e line 1. -Original Message- From: Perrin Harkins [mailto:[EMAIL PROTECTED] Sent: Monday, June 02, 2003 2:41 PM To: [EMAIL PROTECTED] Cc: modperl Subject: Re: Apache::Cookie On Mon, 2003-06-02 at 09:05, cap wrote: i have an application that uses CGI and sets the cookie values as a hashref. im then attempting to retreive the values with Apache::Cookie with: $cookies = Apache::Cookie->fetch; $ccokies is a hashref so i should be able to get the individual values with: $cookies->{uid}; right? however, this doesn't appear to work. I see the problem. There is mistake in the Apache::Cookie documentation, but the correct way to do this is shown in the mod_perl guide: http://perl.apache.org/docs/1.0/guide/porting.html#Converting_to_us e_Apache_Perl_Modules Change your last line to this: my $uid = defined $cookies->{'uid'} ? $cookies->{'uid'}->value() : undef; - Perrin -- __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
RE: Apache::Cookie
Well, here's what I have to do to get direct access to values from the original cookie hash: my $cookies = Apache::Cookie->fetch; my %hash = defined $cookies->{'session'} ? $cookies->{'session'}->value : undef; Strange. Thanks for the lead. >-Original Message- >From: Perrin Harkins [mailto:[EMAIL PROTECTED] >Sent: Monday, June 02, 2003 2:41 PM >To: [EMAIL PROTECTED] >Cc: modperl >Subject: Re: Apache::Cookie > > >On Mon, 2003-06-02 at 09:05, cap wrote: >> i have an application that uses CGI and sets the cookie values >as a hashref. >> im then attempting to retreive the values with Apache::Cookie with: >> >> $cookies = Apache::Cookie->fetch; >> >> $ccokies is a hashref so i should be able to get the individual >values with: >> >> $cookies->{uid}; >> >> right? however, this doesn't appear to work. > >I see the problem. There is mistake in the Apache::Cookie >documentation, but the correct way to do this is shown in the mod_perl >guide: >http://perl.apache.org/docs/1.0/guide/porting.html#Converting_to_us >e_Apache_Perl_Modules > >Change your last line to this: > >my $uid = defined $cookies->{'uid'} ? $cookies->{'uid'}->value() : >undef; > >- Perrin >
Re: Apache::Cookie
On Mon, 2003-06-02 at 09:05, cap wrote: > i have an application that uses CGI and sets the cookie values as a hashref. > im then attempting to retreive the values with Apache::Cookie with: > > $cookies = Apache::Cookie->fetch; > > $ccokies is a hashref so i should be able to get the individual values with: > > $cookies->{uid}; > > right? however, this doesn't appear to work. I see the problem. There is mistake in the Apache::Cookie documentation, but the correct way to do this is shown in the mod_perl guide: http://perl.apache.org/docs/1.0/guide/porting.html#Converting_to_use_Apache_Perl_Modules Change your last line to this: my $uid = defined $cookies->{'uid'} ? $cookies->{'uid'}->value() : undef; - Perrin
RE: Apache::Cookie
On Mon, 2003-06-02 at 16:30, cap wrote: > Yes, but: > > use Apache::Cookie; > > my $cookie = Apache::Cookie->fetch; > my @values = $cookie->value; > > returns errors. The value() call isn't meant to be used with fetch(). Your original example looked fine to me. What was not working about it? Did you verify that there was an actual cookie header coming in? - Perrin
RE: Apache::Cookie
Yes, but: use Apache::Cookie; my $cookie = Apache::Cookie->fetch; my @values = $cookie->value; returns errors. >-Original Message- >From: Jason Galea [mailto:[EMAIL PROTECTED] >Sent: Monday, June 02, 2003 5:56 AM >To: [EMAIL PROTECTED] >Cc: modperl >Subject: Re: Apache::Cookie > > >Have you consulted the documentation? > >http://search.cpan.org/author/JIMW/libapreq-1.1/Cookie/Cookie.pm#value > > >cap wrote: >> i have an application that uses CGI and sets the cookie values >as a hashref. >> im then attempting to retreive the values with Apache::Cookie with: >> >> $cookies = Apache::Cookie->fetch; >> >> $ccokies is a hashref so i should be able to get the individual >values with: >> >> $cookies->{uid}; >> >> right? however, this doesn't appear to work. >> >> >> >> > >
Re: Apache::Cookie
Have you consulted the documentation? http://search.cpan.org/author/JIMW/libapreq-1.1/Cookie/Cookie.pm#value cap wrote: i have an application that uses CGI and sets the cookie values as a hashref. im then attempting to retreive the values with Apache::Cookie with: $cookies = Apache::Cookie->fetch; $ccokies is a hashref so i should be able to get the individual values with: $cookies->{uid}; right? however, this doesn't appear to work.
Apache::Cookie
i have an application that uses CGI and sets the cookie values as a hashref. im then attempting to retreive the values with Apache::Cookie with: $cookies = Apache::Cookie->fetch; $ccokies is a hashref so i should be able to get the individual values with: $cookies->{uid}; right? however, this doesn't appear to work.
Re: Has Apache::Cookie been ported to mod_perl-2 yet?
[EMAIL PROTECTED] wrote: No it hasn't. Need to use CGI::Cookie for the time being. Apache::Cookie and Apache::Request I believe are both either provided by or dependent on libapreq, which is still a work in progress for apache2/mod_perl2. That's the biggest reason I'm still using Apache 1.3.x now. Incidentally, I recommend CGI::Lite. It's very small and fast, and has an API close enough to Apache::Request that you could easilly convert your code later. Handles cookies as well. - Perrin
Re: Has Apache::Cookie been ported to mod_perl-2 yet?
No it hasn't. Need to use CGI::Cookie for the time being. Apache::Cookie and Apache::Request I believe are both either provided by or dependent on libapreq, which is still a work in progress for apache2/mod_perl2. That's the biggest reason I'm still using Apache 1.3.x now. Wes Sheldahl "Charles McElhose Jr." <[EMAIL PROTECTED]> on 02/10/2003 10:43:57 PM To:[EMAIL PROTECTED] cc: Subject:Has Apache::Cookie been ported to mod_perl-2 yet? Has Apache::Cookie been ported to mod_perl-2 yet? I tried to install the libapreq-1.1 module with mod_perl-2/apache 2 and am getting a "can't locate Apache/MyConfig.pm ..." error. Charles M. [EMAIL PROTECTED]
Has Apache::Cookie been ported to mod_perl-2 yet?
Has Apache::Cookie been ported to mod_perl-2 yet? I tried to install the libapreq-1.1 module with mod_perl-2/apache 2 and am getting a "can't locate Apache/MyConfig.pm ..." error. Charles M. [EMAIL PROTECTED]
Re: Fw: Has Apache::Cookie been ported to mod_perl-2 yet?
Charles O. McElhose Jr. wrote: Thanks, is there any word on when this may happen? Subscribe to the apreq-dev list to stay up to date with the recent developments http://httpd.apache.org/apreq/ meanwhile use CGI::Cookie if you work with mod_perl 2.0. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Fw: Has Apache::Cookie been ported to mod_perl-2 yet?
Thanks, is there any word on when this may happen? Charles
Fw: Has Apache::Cookie been ported to mod_perl-2 yet?
Has Apache::Cookie been ported to mod_perl-2 yet? I tried to install the libapreq-1.1 module with mod_perl-2/apache 2 and am getting a "can't locate Apache/MyConfig.pm ..." error. Charles M.
Re: Apache::Cookie - weird values returned...
Eric Sammer wrote: > the expire *i'm* specifying is just a relative '-1D' to cause the > browser to drop it. if there's a better way, i'm certainly open to > suggestions. The HTTP headers do not support relative dates as far as I know. Thus when you specify a relative date the code must claculate the expiry date for you and send it back to the browser. If a user has their date and time set such that the cookie is still valid they will continue to return it. You might want to consider invalidating the cookie by setting the content to an empty value as well as setting the expiry date. This would then mean that even if they still think it's valid they have no value, only an empty string (which, AFAIK, most browsers will treat as an invalid cookie). You might be more comfortable making the expiry more than a day old. I logged onto a machine the other day and started getting browser messages that my server's security certificate had expired or was not yet valid. It turned out that the RTC on the machine was set to 1980. Maybe the user just wanted to relive the 80's ;) Rob Lambden
Re: Apache::Cookie - weird values returned...
Rob Lambden wrote: I've had problems with scripts and mod_perl code before where I inadvertently create keys in a hash when I'm testing to see if they exist. I now always use something Like: i always use either defined or exists as appropriate to avoid these errors. i've gotten bitten in the bottom by the same things many times in the past... i learned my lesson. ;) > If the key did not exist previously it may be created by this process. The key can exist but hold an undefined value. again, in this case, the key is an Apache::Cookie object which couldn't accidentally be created as a "simple" type like a string key can. Is this an internal redirect, or a redirect sent from the browser ? the logout handler expires the cookie, sets the Location header, and returns REDIRECT. in other words, it's not internal nor a subrequest (unless a returned REDIRECT with a Location header is still considered a subrequest - that would be a surprise to me). If it's internal then the cookie will still exist unless you deleted the key yourself, and if you run the request As a sub-request it can pick up the submitted cookie again even if you have deleted the key on your parent request object. yea... unfortunately, that's not the case here... the browser regains control enough to handle the Set-Cookie (again, unless my perl/mod_perl/cgi books are all out of date)... ;) If it's coming back from the browser are you sure that the browser isn't sending you an empty Cookie? the cookie is a real cookie (in the headers) with the absence of the value. specifically, the return value of the Apache::Cookie->value() method. Maybe some users have broken browsers ? with the current state of things, i'm sure that's part of it. :) that said, there's always a limited set of options on that front. most of my (personal) testing is with mozilla on linux built from source (gentoo portage, actually) but similar behavior is seen on my mac os x boxes. You might also want to check hoe the cookie gets expired. What is the expiry date that is set on the Set-cookie: header that goes back to the client, and what is the date on that machine? the expire *i'm* specifying is just a relative '-1D' to cause the browser to drop it. if there's a better way, i'm certainly open to suggestions. Could you make do with per-session cookies (which have no expory date, but are only valid for the duration of that browser session) ? actually, all of these cookies are per-session which is why this isn't a "hey, the building is on fire!" sort of problem. the logout is one of those superfulous things that might be needed should the non-tech staff force us to add the dreaded "save my username/password" feature to the site. either way, i'd rather try and get the problem out of the way prior to such escalation. Although it's helpful to get to the bottom of any issue, you might be more at peace if you just checked to see if the value of the cookie was valid. yea... i suppose that's an option (and it *was* like that). i just get scared when something isn't working exactly as i understand it to be. it's that age old developer mantra of "unpredictable working code is worse than predictable broken code." After all, who's to say that the cookie they're sending you is actually the same as the one you sent them in the first place ;) damn browsers... damn cookies. i'm still waiting (and will be for a long time to come) for two things: working stateful web development and flying cars... something tells me the latter is a more attainable goal. ;) (Just for the record I don't actually use Apache::Cookie myself I look in and set the headers) i used to do that all the time too. i've always felt that abstraction prevents errors in the long run (or at least makes them easier to find). being wrong sucks. thanks for the response... i'll give some of these ideas a shot (again, where applicable). -- Eric Sammer [EMAIL PROTECTED] http://www.linuxstep.org
RE: Apache::Cookie - weird values returned...
Eric Sammer wrote: > What is weird is that the Apache::Cookie object DOES exist, it's just the value > that's all wacked out or just plain missing. I've had problems with scripts and mod_perl code before where I inadvertently create keys in a hash when I'm testing to see if they exist. I now always use something Like: if((exists($cookie->{user_id})) && (defined($cookie->{user_id}))) Just doing if(defined .. Checks to see if the value of the key is defined. If the key did not exist previously it may be created by this process. The key can exist but hold an undefined value. > The problem is that the logout handler (which expires the user_id cookie) kills the > cookie and redirects to / ok, but when the GroupAccess handler checks if the cookie > exists (during the / request), $cookies->{user_id}* is defined, but the value seems to > be an empty string ala "". Is this an internal redirect, or a redirect sent from the browser ? If it's internal then the cookie will still exist unless you deleted the key yourself, and if you run the request As a sub-request it can pick up the submitted cookie again even if you have deleted the key on your parent request object. If it's coming back from the browser are you sure that the browser isn't sending you an empty Cookie? Maybe some users have broken browsers ? You might also want to check hoe the cookie gets expired. What is the expiry date that is set on the Set-cookie: header that goes back to the client, and what is the date on that machine? Could you make do with per-session cookies (which have no expory date, but are only valid for the duration of that browser session) ? Although it's helpful to get to the bottom of any issue, you might be more at peace if you just checked to see if the value of the cookie was valid. After all, who's to say that the cookie they're sending you is actually the same as the one you sent them in the first place ;) (Just for the record I don't actually use Apache::Cookie myself I look in and set the headers) Rob Lambden
Apache::Cookie - weird values returned...
All: I've got a strange Apache::Cookie issue that seems to have recently snuck up on me, although I've seen similar behavior in the past. I have a PerlAccessHandler called GroupAccess that handles all access to a site**. If there's a user_id cookie, it pulls urls allowed to that user from a db, otherwise, an "anonymous" set of urls that are allowed - certainly not rocket science. The problem is that the logout handler (which expires the user_id cookie) kills the cookie and redirects to / ok, but when the GroupAccess handler checks if the cookie exists (during the / request), $cookies->{user_id}* is defined, but the value seems to be an empty string ala "". This really makes things difficult. What is weird is that the Apache::Cookie object DOES exist, it's just the value that's all wacked out or just plain missing. Could it be bug in Apache::Cookie that only shows up during internal redirects (and when I'm not looking)? This problem is incredibly difficult to reproduce as it only happens about 1 out of ever 30 - 40 times... That said, when it does happen, users complain and that's not cool at all. * $cookies is a hash ref with cookie names as keys and Apache::Cookie objects as values. ** The site in question: http://www.bluemonkeystuff.com Thanks in advance! -- Eric Sammer [EMAIL PROTECTED] http://www.linuxstep.org
Re: modperl 2.0 problems with Apache::Cookie and related modules.
b. ash wrote: Hi, I am trying to configure a working apache2/modperl2 setup, unfortunately I can not seemt to get a critical module Apache::Cookie to install, I keep getting this error. Can't locate Apache/MyConfig.pm in @INC (@INC contains: /usr/local/lib/perl5/5.8.0/i686-linux-thread-multi /usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl .) at Makefile.PL line 27. BEGIN failed--compilation aborted at Makefile.PL line 27. any ideas what might be going on here. A backcompat version of Apache::MyConfig is now available via Apache::compat in the mod_perl cvs. Though it won't solve the Apache::Cookie lib as reported by others. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
RE: modperl 2.0 problems with Apache::Cookie and related modules.
Hi - You may want to check out my experiences w/ap2-mp2 shown in: http://beaucox.com/mason/mason-with-apmp2-mini-HOWTO.htm It shows how I intalled these packages. Aloha => Beau. -Original Message- From: b. ash [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 10:40 AM To: [EMAIL PROTECTED] Subject: modperl 2.0 problems with Apache::Cookie and related modules. Hi, I am trying to configure a working apache2/modperl2 setup, unfortunately I can not seemt to get a critical module Apache::Cookie to install, I keep getting this error. Can't locate Apache/MyConfig.pm in @INC (@INC contains: /usr/local/lib/perl5/5.8.0/i686-linux-thread-multi /usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl .) at Makefile.PL line 27. BEGIN failed--compilation aborted at Makefile.PL line 27. any ideas what might be going on here. Thanks --bash
Re: modperl 2.0 problems with Apache::Cookie and related modules.
On Thu, 19 Dec 2002, b. ash wrote: > Hi, > > I am trying to configure a working apache2/modperl2 setup, unfortunately > I can not seemt to get a critical module Apache::Cookie to install, I > keep getting this error. > > Can't locate Apache/MyConfig.pm in @INC (@INC contains: > /usr/local/lib/perl5/5.8.0/i686-linux-thread-multi > /usr/local/lib/perl5/5.8.0 > /usr/local/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi > /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl .) > at Makefile.PL line 27. > BEGIN failed--compilation aborted at Makefile.PL line 27. > > any ideas what might be going on here. Apache::Cookie (and Apache::Request) haven't been ported to mod_perl-2 yet. Until that happens, you can use the mod_perl-2 compatibility mode to do form data, and for cookies, you can use a CPAN module (eg, CGI.pm). -- best regards, randy kobes
modperl 2.0 problems with Apache::Cookie and related modules.
Hi, I am trying to configure a working apache2/modperl2 setup, unfortunately I can not seemt to get a critical module Apache::Cookie to install, I keep getting this error. Can't locate Apache/MyConfig.pm in @INC (@INC contains: /usr/local/lib/perl5/5.8.0/i686-linux-thread-multi /usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl .) at Makefile.PL line 27. BEGIN failed--compilation aborted at Makefile.PL line 27. any ideas what might be going on here. Thanks --bash
Re: NEWBIE: Apache and Apache Cookie Module missing?
On Sun, 24 Nov 2002, Joe Palladino wrote: > I have a Redhat 7.3 system running Apache 1.3.23, perl 5.6.1, > and the latest updates. I am trying to do something very > simple, set a cookie and read it. I ran perl -MCPAN -e shell > and installed libnet, Bundle::Apache, etc. > > I put the following in my httpd.conf > > PerlModule Apache > PerlModule Apache::Cookie You need the libapreq package, from CPAN, for Apache::Cookie and Apache::Request. -- best regards, randy kobes
NEWBIE: Apache and Apache Cookie Module missing?
I have a Redhat 7.3 system running Apache 1.3.23, perl 5.6.1, and the latest updates. I am trying to do something very simple, set a cookie and read it. I ran perl -MCPAN -e shell and installed libnet, Bundle::Apache, etc. I put the following in my httpd.conf PerlModule Apache PerlModule Apache::Cookie PerlModule CGI PerlModule CGI::Cookie and my code is use Apache::Constants qw(:common); use Apache::Cookie (); use Apache(); my $r; Apache->request([$r]); I get the error that the request object is not found and have I loaded the Apache module. As far as I can tell I am doing everything right. Can someone point me in the right direction? Thank you, Joe Palladino --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.422 / Virus Database: 237 - Release Date: 11/20/2002
Re: mp2.0 Apache::Cookie
Rafael Amer Ramon wrote: Hi. I'm trying to upgrade my apache+mod_perl server form versions 1.3.27 (Apache) and 1.27 (mod_perl) to versions 2.0.43 and 2.0 but I have a problem with cookies. With mod_perl 1.27 I use Apache::Cookie from libapreq-1.0 and I cannot fount a similar module for mod_perl 2.0. It wasn't ported to 2.0 yet. The C core is almost completed though. Does anybody knows how I can handle cookies, send and get values, in a mod_perl 2.0 handler? Try using CGI::Cookie or check other similar modules on CPAN. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:stas@;stason.org http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
mp2.0 Apache::Cookie
Hi. I'm trying to upgrade my apache+mod_perl server form versions 1.3.27 (Apache) and 1.27 (mod_perl) to versions 2.0.43 and 2.0 but I have a problem with cookies. With mod_perl 1.27 I use Apache::Cookie from libapreq-1.0 and I cannot fount a similar module for mod_perl 2.0. Does anybody knows how I can handle cookies, send and get values, in a mod_perl 2.0 handler? Thanks. -- _/_/ _/_/_/_/ _/_/_/ Rafael Amer Ramon _/_/ _/_/ _/ Departament de Matemàtica Aplicada II _/_/ _/_/_/_/ _/E.T.S.E.I.T. _/_/ _/_/ Universitat Politècnica de Catalunya _/_/_/_/ _/_/_/_/_/e-mail: [EMAIL PROTECTED] --
Re: BUG: Apache::Cookie v1.0
On Monday, 2002-09-23 at 11:11:02 -0400, darren chamberlain wrote: > * Michael McLagan <[EMAIL PROTECTED]> [2002-09-21 11:45]: > > There is a bug in Apache::Cookie. It doesn't handle a cookie with > > zero bytes in it! > This is because Apache::Cookie is implemented in C, and C uses NULL as > the end of string terminator. No quite accurate. C has no concept of a string. There are a number of library functions for string handling that use '\0' as the string terminator. If somebody rewrites Apache::Cookie to replace those functions, it will be able to handle such cookies. > This is probably something that needs to be done in Perl, since I doubt > there's a way to check for "embedded" NULLs in a string in C... /* We assume there will always a '\0' to be found. */ char * find_nul(char *str) { while (*str) { str++; } return str; } What interests me much more is *why* a cookie should be able to contain *any* control character. If you want binary data in a cookie, you should encode it somehow. If the '\0' was a '\n', things would be much more interesting ... Lupe Christoph -- | [EMAIL PROTECTED] | http://www.lupe-christoph.de/ | | Big Misunderstandings #6398: The Titanic was not supposed to be| | unsinkable. The designer had a speech impediment. He said: "I have | | thith great unthinkable conthept ..." |
Re: BUG: Apache::Cookie v1.0
* Michael McLagan <[EMAIL PROTECTED]> [2002-09-21 11:45]: > There is a bug in Apache::Cookie. It doesn't handle a cookie with > zero bytes in it! This is because Apache::Cookie is implemented in C, and C uses NULL as the end of string terminator. This is probably something that needs to be done in Perl, since I doubt there's a way to check for "embedded" NULLs in a string in C... (darren) -- If you wish to drown, do not torture yourself with shallow water.
Re: BUG: Apache::Cookie v1.0
Once upon a time, I wrote: > There is a bug in Apache::Cookie. It doesn't handle a cookie > with zero bytes in it! A clarification, it's not a zero length cookie that is mishandled, it's a cookie with an embedded NUL (zero) character. Michael
BUG: Apache::Cookie v1.0
Hello, There is a bug in Apache::Cookie. It doesn't handle a cookie with zero bytes in it! $value = "ABCD" . chr(0) . "EFGH"; $cookie = Apache::Cookie->new($request, -name=> 'oatmeal', -value=> $value, -domain=>$ENV{'SERVER_NAME'}, -path=>"/"); print $cookie->as_string; The output looks like: oatmeal=ABCD; domain=my.web.server.com; path=/; expires=0 Where did the rest of my cookie go?! Should I not have gotten: oatmeal=ABCD%00EFGH; domain=my.web.server.com; path=/; expires=0 Michael
Apache::Cookie under mod_perl
Using mod_perl, I am serving my pages from port 8050 - how can I ensure that the cookies I send using Apache::Cookie appends this port on to the end of the domain in the cookie that I send back to the browser? Thanks PC
[SOLVED] Re: Redhat 7.2 glibc update causes problems with Apache::Cookie?
FYI, I finally got my problems with Apache::Cookie (part of libapreq) solved. Much thanks to Stas for advice on solving this problem. Here's what I found: 1) Installing the glibc 2.2.4-24 updates borked the RPM installed perl 5.6.1. Building 5.6.1 from source fixed this problem. 2) libapreq 1.0 installs the libapreq.* files into /usr/local/lib. I ended up adding the path to ld.conf. Not sure if this was necessary.
Re: Redhat 7.2 glibc update causes problems with Apache::Cookie?
Edward Moon wrote: > I did that Stas. I forgot to mention that I updated Apache::Cookie via > CPAN. weird, I've glibc 2.2.4 and no such a problem (mandrake 8.2 here). In any case follow the path that it cannot find. Also try to strace(1) the startup to see exactly where it looks for libapreq.so. Or try the simpler: % strace perl -MApache::Cookie -e1 grep for apreq > On Fri, 19 Apr 2002, Stas Bekman wrote: > [snip] > >>looks like you have a broken or missing binary package. It says exactly >>what's your problem - it cannot find the library. Check that you have >>the right symlinks from libapreq.so.1.0.0 to libapreq.so.1, or whatever >>it is. >> >>Have you tried building from the sources? >> >>perl -MCPAN -eshell >>cpan> install Apache::Cookie >>__ >>Stas BekmanJAm_pH --> Just Another mod_perl Hacker >>http://stason.org/ mod_perl Guide ---> http://perl.apache.org >>mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com >>http://modperlbook.org http://apache.org http://ticketmaster.com >> > -- __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Redhat 7.2 glibc update causes problems with Apache::Cookie?
I did that Stas. I forgot to mention that I updated Apache::Cookie via CPAN. On Fri, 19 Apr 2002, Stas Bekman wrote: [snip] > looks like you have a broken or missing binary package. It says exactly > what's your problem - it cannot find the library. Check that you have > the right symlinks from libapreq.so.1.0.0 to libapreq.so.1, or whatever > it is. > > Have you tried building from the sources? > > perl -MCPAN -eshell > cpan> install Apache::Cookie > __ > Stas BekmanJAm_pH --> Just Another mod_perl Hacker > http://stason.org/ mod_perl Guide ---> http://perl.apache.org > mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com > http://modperlbook.org http://apache.org http://ticketmaster.com >
Re: Redhat 7.2 glibc update causes problems with Apache::Cookie?
Edward Moon wrote: > I recently applied the glibc updates described at > <http://www.redhat.com/support/errata/RHBA-2002-056.html> to a system > running Apache 1.2.22/modperl 1.2.26 on a Perl 5.6.1/Redhat Linux 7.2 > system. > > All seemed well until I updated Apache::Cookie to the latest version and > restarted apache. > > Apache failed to start and I got the following error messages: > > Starting httpd: [Thu Apr 18 13:42:14 2002] [error] Can't load > '/usr/local/lib/perl5/site_perl/5.6.1/i686-linux/auto/Apache/Cookie/Cookie.so' > for module Apache::Cookie: libapreq.so.1: cannot open shared object file: > No such file or directory at looks like you have a broken or missing binary package. It says exactly what's your problem - it cannot find the library. Check that you have the right symlinks from libapreq.so.1.0.0 to libapreq.so.1, or whatever it is. Have you tried building from the sources? perl -MCPAN -eshell cpan> install Apache::Cookie __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Redhat 7.2 glibc update causes problems with Apache::Cookie?
I recently applied the glibc updates described at <http://www.redhat.com/support/errata/RHBA-2002-056.html> to a system running Apache 1.2.22/modperl 1.2.26 on a Perl 5.6.1/Redhat Linux 7.2 system. All seemed well until I updated Apache::Cookie to the latest version and restarted apache. Apache failed to start and I got the following error messages: Starting httpd: [Thu Apr 18 13:42:14 2002] [error] Can't load '/usr/local/lib/perl5/site_perl/5.6.1/i686-linux/auto/Apache/Cookie/Cookie.so' for module Apache::Cookie: libapreq.so.1: cannot open shared object file: No such file or directory at /usr/local/lib/perl5/5.6.1/i686-linux/DynaLoader.pm line 2/usr/lib/perl5/site_perl/5.6.1/i386-linux06. at /usr/local/lib/perl5/site_perl/5.6.1/i686-linux/mod_perl.pm line 14 Compilation failed in require at /usr/local/apache/mason/handler.pl line 33. BEGIN failed--compilation aborted at /usr/local/apache/mason/handler.pl line 33. Compilation failed in require at (eval 5) line 1. /usr/local/apache/bin/apachectl start: httpd could not be started I can find Cookie.so at the directory: drwxr-xr-x2 root root 4096 Apr 18 08:25 . drwxr-xr-x 11 root root 4096 Dec 8 15:32 .. -r--r--r--1 root root0 Nov 19 08:57 Cookie.bs -r-xr-xr-x1 root root16669 Apr 18 08:25 Cookie.so I suspect that this is an issue with the glibc update not Apache::Cookie since I'm also having similar problems with Image::Magick and Time::HiRes (modules I haven't updated) while updated modules like Storable still work. Can anyone confirm this problem? Thanks,
Apache::Cookie->expires under Windows
Hi, All, I posted a message on the subject a little earlier, but apparently I need to learn more. The Apache::Cookie->expires as below adds unwanted information (header dump attached) to the date and subsequently does not want to bake ($cookie->bake). This is the code: my $cookie = Apache::Cookie->new( $r, -name=>"access", -value=>$cookie{"access"}->value, -expires=>'+20m' ); I run ActiveState Perl under the Win32 (WinME) with mod_perl 1.26 under Apache 1.3.22. Whether I run it on the Linux or use CGI::Cookie everything goes just fine. What's so wrong with Windows or the script or mod_perl (libapreq) that this happens? Cheers, Alexei mailto:[EMAIL PROTECTED]
Re: libapreq. Apache::Cookie returns different 'expires' than CGI::Cookie?
Hello, darren, Friday, December 14, 2001, 9:39:46 PM, you wrote: dc> Alexei Danchenkov <[EMAIL PROTECTED]> said something to this effect on 12/14/2001: >> Hello, All! >> I wonder why my '$cookie->expires' for this code returns a >> different result than the similar one with CGI::Cookie >> (commented). The result is different in a way that some >> additional binary code is being added to the expiry date. >> >> $cookie = Apache::Cookie->new( $r, >> -name=>"access", >> -value=>$value, >> -expires=>"+10m" ); >> >> #my $cookie = new CGI::Cookie( >> -name=>"access", >> -value=>$value, >> -expires=>"+10m" ); >> >> $expiry = $cookie->expires; >> >> Any suggestions? dc> Maybe I'm just slow, but I can see the difference between the dc> two. Can you elaborate? dc> (darren) The only apparent difference that I see is that Apache::Cookie->new requires $r to be sent to it as a first parameter, where CGI::Cookie does not. Per the Apache::Cookie manpage, that should lead to the same result, but does not in my case. The cookie does not disappear. The expiry property however, gets changed and then the $cookie->bake (or $r->err_headers_out->add( "Set-Cookie" => $cookie->as_string )), which should add 'Set-cookie' to the header does not work. Here is an example of what Apache::Cookie->new returns: cÑ% @cÑ%@cÑ%@cD$ áu9DTc~.Ñ DTc X@cÛ HTcu?h, 17-cÛ HTcu?h-2001 14:35:10 GMT new CGI::Cookie rather returns proper: Mon, 17-Dec-2001 14:35:54 GMT May be it worth noting that I am using Win32 (WindowsME) as a devel machine and Red Hat 6.2 as a server, where it does not work either with the same mistake. I am still bugged - can't find what's wrong. Alexei mailto:[EMAIL PROTECTED]
Re: libapreq. Apache::Cookie returns different 'expires' than CGI::Cookie?
Alexei Danchenkov <[EMAIL PROTECTED]> said something to this effect on 12/14/2001: > Hello, All! > I wonder why my '$cookie->expires' for this code returns a > different result than the similar one with CGI::Cookie > (commented). The result is different in a way that some > additional binary code is being added to the expiry date. > > $cookie = Apache::Cookie->new( $r, > -name=>"access", > -value=>$value, > -expires=>"+10m" ); > > #my $cookie = new CGI::Cookie( > -name=>"access", > -value=>$value, > -expires=>"+10m" ); > > $expiry = $cookie->expires; > > Any suggestions? Maybe I'm just slow, but I can see the difference between the two. Can you elaborate? (darren) -- Blore's Razor: Given a choice between two theories, take the one which is funnier.
libapreq. Apache::Cookie returns different 'expires' than CGI::Cookie?
Hello, All! I wonder why my '$cookie->expires' for this code returns a different result than the similar one with CGI::Cookie (commented). The result is different in a way that some additional binary code is being added to the expiry date. $cookie = Apache::Cookie->new( $r, -name=>"access", -value=>$value, -expires=>"+10m" ); #my $cookie = new CGI::Cookie( -name=>"access", -value=>$value, -expires=>"+10m" ); $expiry = $cookie->expires; Any suggestions? Cheers, Alexei mailto:[EMAIL PROTECTED]
Re: Apache::Cookie bug with value => undef
On Mon, 8 Oct 2001, Ged Haywood wrote: > Have you tried doing > > Apache::Cookie->new( $r, >-name => 'foo', >-value => { wont_break => '1', not_at_all_borked => '' } )->bake; > > instead? I can hardly control the order in which values are written out to the cookie via a hash! Unless instead of an anonymous hash, I passed in a reference to a tied hash or something. > > I tried to fix it but I am a C gimp and don't know WTF I am doing. > > Please don't modify the function ap_getword() in src/main/util.c as > that will probably break all sorts of things. No, I was trying to fix it in apache_cookie.c It could simply check if the next char was '&' before calling ap_getword. > I'd leave this new function in the same file (util.c) for a quick hack > but if you leave it like that then ten to one you'll forget it's in > there and have to do it all over again next time you upgrade Apache. > > It's still better to find a way around the problem than to do > something nasty like this. I was trying to patch Apache::Cookie, not Apache. Apache is doing what it says, and is therefore correct. Its simply not desirable to use that function in that particular place in the apache_cookie.c file. -dave /*== www.urth.org We await the New Sun ==*/
Re: Apache::Cookie bug with value => undef
Hi Dave, On Mon, 8 Oct 2001, Dave Rolsky wrote: > Apache::Cookie->new( $r, >-name => 'foo', >-value => { will_break => '', completely_borked => 1 } )->bake; Have you tried doing Apache::Cookie->new( $r, -name => 'foo', -value => { wont_break => '1', not_at_all_borked => '' } )->bake; instead? > The problem is here in apache_cookie.c > > while (*pair && (val = ap_getword(r->pool, &pair, '&'))) { Quite so. > I tried to fix it but I am a C gimp and don't know WTF I am doing. Please don't modify the function ap_getword() in src/main/util.c as that will probably break all sorts of things. You could make a function like it by copying everything in the function API_EXPORT(char*) ap_getword() { ... ... while(*pos == stop) { ++pos; } ... ... } and making a new one for example API_EXPORT(char*) dave_ap_getword() { ... ... /* while(*pos == stop) { ++pos; } */ ... ... } and then call that instead. You will need to find the header file which declares the function and put a declaration along the same lines in there and then recompile. I'd leave this new function in the same file (util.c) for a quick hack but if you leave it like that then ten to one you'll forget it's in there and have to do it all over again next time you upgrade Apache. It's still better to find a way around the problem than to do something nasty like this. HTH, 73, Ged.
Apache::Cookie bug with value => undef
If I do this: Apache::Cookie->new( $r, -name => 'foo', -value => { will_break => '', completely_borked => 1 } )->bake; and then I later try to read the cookie in and do this: my %c = Apache::Cookie->fetch; my %cookie = $c{foo}->value; print $cookie{will_break}; It will print 'completely_borked'! The cookie's value looks something like this when sent to the browser: will_break&&completely_borked&1 The problem is here in apache_cookie.c while (*pair && (val = ap_getword(r->pool, &pair, '&'))) { ap_unescape_url((char *)val); ApacheCookieAdd(c, val); } Here's a line from the ap_getword docs. Copies everything from line up to stop to a new string. line is updated to point to the first character after stop. Multiple occurrences of stop are skipped if present. It's that multiple occurrences are skipped bit that's causing the trouble. I tried to fix it but I am a C gimp and don't know WTF I am doing. -dave /*== www.urth.org We await the New Sun ==*/
Apache::Cookie
I must first thank all of you that helped and apologize to you... I now know why I was not able to read and write my cookies. The "Domain". my module is now happy to accommodate my request after changing from "http://localhost/..."; to the appropriate "http://mymachine.mydomain.com/...";. Thanks to you all for responding and thank god for the mod_perl archives... cheers thanks -r
Apache::Cookie
Hello, Is there a bug in Apache::Cookie? I am trying to set a cookie using: $webuname = Apache::Cookie->new( $r, -name => 'randh_webuname', -value =>$user, -domain =>'.rhythm.com', -expires =>'+24h',-path =>'/' ); $webuname->bake(); But the cookie never gets set? Can any one tell me what am I doing wrong? I have read the documentation for the Apache::Cookie but I can not set the cookie... Help :( Thanks in advance... -r
Re: Apache::Cookie->fetch fails silently
On Fri, 15 Jun 2001, Rodney Broom wrote: > I've got this handler that calls Apache::Cookie->fetch, no problem. It's > tested and works fine. So I installed the same handler (same machine) on > a second Apache instance, but now Apache::Cookie->fetch fails, causing > the handler to terminate. No messages, no nothin'. It doesn't even get > to the next print() statement after the fetch() call. try Apache::Cookie->new($r)->parse; Apache::Cookie->fetch uses the global request_rec which might not be setup yet, depending on what phase you're in. you could also set it up yourself first: Apache->request($r); Apache::Cookie->fetch;
Re: CGI::Cookie vs Apache::Cookie -- help?
On Mon, Jun 18, 2001 at 07:18:56AM +0200, Per Einar wrote: > > - Original Message - > From: "will trillich" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, June 18, 2001 7:09 AM > Subject: Re: CGI::Cookie vs Apache::Cookie -- help? > > what does $cookie->bake do (add set-cookie header) that > > $r->header_out('set-cookie'=>$cookie) (add set-cookie header) > > does not? > > > > [ and why ain't that mentioned in the manual? ] > > As someone else stated, bake() actually sends a Set-Cookie header, but with > $cookie->as_string and not just $cookie (which is an instance of > Apache::Cookie). When you're just sending $cookie you're sending an object > reference. > > Per Einar Ellefsen > [EMAIL PROTECTED] my grok quotient has grown considerably. thanks! -- I figure: if a man's gonna gamble, may as well do it without plowing. -- Bama Dillert, "Some Came Running" [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!
Re: CGI::Cookie vs Apache::Cookie -- help?
- Original Message - From: "will trillich" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, June 18, 2001 7:09 AM Subject: Re: CGI::Cookie vs Apache::Cookie -- help? > On Sun, Jun 17, 2001 at 11:14:23PM -0400, Chris Winters wrote: > > * will trillich ([EMAIL PROTECTED]) [010617 23:04]: > > > $r->log_error( qq(...id=$ID, sending cookie) ); > > --this outputs the string i'm hoping for, into the log file. That's because you're outputting $ID and not the cookie itself, which you're creating below. > > > > my $cookie = > > > Apache::Cookie->new( $r, > > > -name => $cookie_name, > > > -value => $ID , > > > -domain => $r->hostname, > > > -path => '/' , > > > ); > > > $r->header_out('Set-Cookie', => $cookie); > > > From 'perldoc Apache::Cookie' > > > >bake > >Put cookie in the oven to bake. (Add a Set-Cookie > >header to the outgoing headers table.) > > > >$cookie->bake; > > what does $cookie->bake do (add set-cookie header) that > $r->header_out('set-cookie'=>$cookie) (add set-cookie header) > does not? > > [ and why ain't that mentioned in the manual? ] As someone else stated, bake() actually sends a Set-Cookie header, but with $cookie->as_string and not just $cookie (which is an instance of Apache::Cookie). When you're just sending $cookie you're sending an object reference. Per Einar Ellefsen [EMAIL PROTECTED]
Re: CGI::Cookie vs Apache::Cookie -- help?
On Sun, Jun 17, 2001 at 11:14:23PM -0400, Chris Winters wrote: > * will trillich ([EMAIL PROTECTED]) [010617 23:04]: > > $r->log_error( qq(...id=$ID, sending cookie) ); --this outputs the string i'm hoping for, into the log file. > > my $cookie = > > Apache::Cookie->new( $r, > > -name => $cookie_name, > > -value => $ID , > > -domain => $r->hostname, > > -path => '/' , > > ); > > $r->header_out('Set-Cookie', => $cookie); > From 'perldoc Apache::Cookie' > >bake >Put cookie in the oven to bake. (Add a Set-Cookie >header to the outgoing headers table.) > >$cookie->bake; what does $cookie->bake do (add set-cookie header) that $r->header_out('set-cookie'=>$cookie) (add set-cookie header) does not? [ and why ain't that mentioned in the manual? ] -- I figure: if a man's gonna gamble, may as well do it without plowing. -- Bama Dillert, "Some Came Running" [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!
Re: CGI::Cookie vs Apache::Cookie -- help?
On Sun, 17 Jun 2001, will trillich wrote: > $r->log_error( qq(...id=$ID, sending cookie) ); > my $cookie = > Apache::Cookie->new( $r, > -name => $cookie_name, > -value => $ID , > -domain => $r->hostname, > -path => '/' , > ); > $r->header_out('Set-Cookie', => $cookie); You forgot to bake your cookie... Read the Apache::Cookie docs again. Get rid of the $r->header_out(...) line and use the following instead. $cookie->bake(); Cees
Re: CGI::Cookie vs Apache::Cookie -- help?
* will trillich ([EMAIL PROTECTED]) [010617 23:04]: > mine is similar: > > $r->log_error( qq(...id=$ID, sending cookie) ); > my $cookie = > Apache::Cookie->new( $r, > -name => $cookie_name, > -value => $ID , > -domain => $r->hostname, > -path => '/' , > ); > $r->header_out('Set-Cookie', => $cookie); > > which sets a cookie value of "SCALAR(0x863c9f8)" instead of the > $ID string that shows up in the log, which is > > ...id=483dd0e2202accce6d4d3e07d976bfdc, sending cookie > > in the original ticket example above, -value is a hashref: > > -value => { ID => $ID } > > instead of > > -value => $ID > > as the Apache::Cookie manpage suggests (a plain scalar value). > > this worked just fine with CGI::Cookie (without the $r, of > course) -- can't get it to return the actual scalar value with > Apache::Cookie... > > ideas? help! >From 'perldoc Apache::Cookie' bake Put cookie in the oven to bake. (Add a Set-Cookie header to the outgoing headers table.) $cookie->bake; as_string Format the cookie object as a string: #same as $cookie->bake $r->err_headers_out->add("Set-Cookie" => $cookie->as_string); HTH Chris -- Chris Winters ([EMAIL PROTECTED]) Building enterprise-capable snack solutions since 1988.
CGI::Cookie vs Apache::Cookie -- help?
On Sat, Jun 16, 2001 at 12:58:14AM +0200, Nenad wrote: > package Apache::PermanentTicketRenewer > my Counter; > sub handler { > my $r = shift; > > $Counter += 1; > my $cookie = CGI::Cookie->new(-name => 'Ticket', > -path => '/', > -domain => '.my.com', > -expires => '+1M', > -value => { 'ID' => $Counter } >); mine is similar: $r->log_error( qq(...id=$ID, sending cookie) ); my $cookie = Apache::Cookie->new( $r, -name => $cookie_name, -value => $ID , -domain => $r->hostname, -path => '/' , ); $r->header_out('Set-Cookie', => $cookie); which sets a cookie value of "SCALAR(0x863c9f8)" instead of the $ID string that shows up in the log, which is ...id=483dd0e2202accce6d4d3e07d976bfdc, sending cookie in the original ticket example above, -value is a hashref: -value => { ID => $ID } instead of -value => $ID as the Apache::Cookie manpage suggests (a plain scalar value). this worked just fine with CGI::Cookie (without the $r, of course) -- can't get it to return the actual scalar value with Apache::Cookie... ideas? help! -- I figure: if a man's gonna gamble, may as well do it without plowing. -- Bama Dillert, "Some Came Running" [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!
Apache::Cookie->fetch fails silently
I've got this handler that calls Apache::Cookie->fetch, no problem. It's tested and works fine. So I installed the same handler (same machine) on a second Apache instance, but now Apache::Cookie->fetch fails, causing the handler to terminate. No messages, no nothin'. It doesn't even get to the next print() statement after the fetch() call. Thoughts? ---Rodney BroomProgrammer: Desert.Net
RE: Can't locate object method "parse" via package "Apache::Cookie"
your syntax is wrong... try my %cookiejar = Apache::Cookie->new($r)->parse; and I assume that you know Apache::Cookie is part of libapreq and not part of the mod_perl distribution... HTH --Geoff -Original Message- From: David Boone To: [EMAIL PROTECTED] Sent: 5/30/01 4:44 PM Subject: Can't locate object method "parse" via package "Apache::Cookie" Using Mason and mod_perl w/ Apache, all the latest versions, I'm getting a weird error I've reinstalled them all, but I can't figure out this error... the debug/anon/13 file is a mason debug file. test.pl is a quick file I whipped up to test if it occured outside of mason, which it indeed did. Obviously test.pl wouldn't ever work, but I think it illustrates the error. I'm afraid I'm doing something very foolish, hopefully someone can set me straight. Thanks, - Dave --- [dave@powerbook dave]$ perl /home/dave/www/mason/debug/anon/13 Can't locate object method "parse" via package "Apache::Cookie" (perhaps you forgot to load "Apache::Cookie"?) at /apache/conf/handler.pl line 75. [dave@powerbook dave]$ cat test.pl use Apache::Cookie; $lkj = parse Apache::Cookie; [dave@powerbook dave]$ perl test.pl Can't locate object method "parse" via package "Apache::Cookie" (perhaps you forgot to load "Apache::Cookie"?) at test.pl line 3. [dave@powerbook dave]$
Can't locate object method "parse" via package "Apache::Cookie"
Using Mason and mod_perl w/ Apache, all the latest versions, I'm getting a weird error I've reinstalled them all, but I can't figure out this error... the debug/anon/13 file is a mason debug file. test.pl is a quick file I whipped up to test if it occured outside of mason, which it indeed did. Obviously test.pl wouldn't ever work, but I think it illustrates the error. I'm afraid I'm doing something very foolish, hopefully someone can set me straight. Thanks, - Dave --- [dave@powerbook dave]$ perl /home/dave/www/mason/debug/anon/13 Can't locate object method "parse" via package "Apache::Cookie" (perhaps you forgot to load "Apache::Cookie"?) at /apache/conf/handler.pl line 75. [dave@powerbook dave]$ cat test.pl use Apache::Cookie; $lkj = parse Apache::Cookie; [dave@powerbook dave]$ perl test.pl Can't locate object method "parse" via package "Apache::Cookie" (perhaps you forgot to load "Apache::Cookie"?) at test.pl line 3. [dave@powerbook dave]$
RE: Apache::Cookie and encoding
> I'd like to use Apache::Cookie, but I'm doing some tricky things with > cookie data, which requires that I do the encoding myself. However, > every time I 'bake' a cookie object, it tries to encode stuff for me. I > don't like this. > > For example, if I've got cookie data that looks like 'foo%21', it > emerges from 'bake' looking like 'foo%2521'. Is there any way to > prevent this behavior? First of all, reading the cookie value in should reverse the weirdness (encoding) that ->bake is doing. Second of all, if it's still a problem, you can either A) design your cookie string to NOT use those characters (like, if % is a separator, choose a : or something), B) use Storable / MIME::Base64 / UUEncode ( which is as simple as pack('u', $val) ! ) , or C) encode it yourself. Hope this helps! L8r, Rob
Apache::Cookie and encoding
Howdy folks, I'd like to use Apache::Cookie, but I'm doing some tricky things with cookie data, which requires that I do the encoding myself. However, every time I 'bake' a cookie object, it tries to encode stuff for me. I don't like this. For example, if I've got cookie data that looks like 'foo%21', it emerges from 'bake' looking like 'foo%2521'. Is there any way to prevent this behavior? Thanks. -- # Erik Arneson <[EMAIL PROTECTED]> Web Engineer # # Mobile: 541.840.3100 GPG Key ID: 1024D/0A2C3C5E # # Office: 541.774.5391<http://www.musiciansfriend.com/> #
Apache::Cookie->bake - When?
I'm slowly porting my development scripts from mod_cgi to mod_perl. I just moved my main authentication handler to PerlFixupHandler (later I'll probably move it to AuthenHandler, but I just want it to work for now). In any case, all of the sudden, my upload script is choking and giving me 400 (Bad request) errors. I wanted to ask if this is because I'm new() and bake()ing a session cookie before I even get around to parsing the upload (and any other data, for that matter), or am I barking up the wrong tree? The upload script itself was working very nicely under Apache::Registry and is using CGI, not Apache (yet). Any ideas? Issac Internet is a wonderful mechanism for making a fool ofyourself in front of a very large audience. --Anonymous Moving the mouse won't get you into trouble... Clicking it might. --Anonymous PGP Key 0xE0FA561B - Fingerprint:7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B
[Apache::Cookie] Segv in Cookie.so ?
Anyone else experiencing segv's in Cookie.so? I'm using mod_perl 1.25, Apache 1.3.14, and libapreq (Apache::Cookie) 0.31.3 with HTML::Mason 0.89. I tried a rebuild of libapreq etc., but it still segv's. I've an authen handler and a request handler, and both use Apache::Cookie. I'm not certain where it's seg faulting... My error log is full of messages about apache's dieing with sig 11, and the screens in the browser are often missing graphics, or coming up with a "document contains no data" dialog at that point. Perhaps it serves one request and then segv's? If this is not a common problem, let me know, and I'll spend some time trying to get a backtrace and recipe to reproduce the bug. -- mailto: (Karl M. Hegbloom) [EMAIL PROTECTED] http://www.microsharp.com phone://USA/WA/360-260-2066
Apache Cookie Question
Hello, I am trying to write cookie information to the access.log file. The fashion I am trying to do it in should break all caching for the /htdocs/images directory. It seems to work for IE cookies, html files get cached, which is good, and I see the cache being broken for the gif in /htdocs/images. I can verify this, because for each access to the gif file in /htdocs/images I see an entry with the associated cookie info in the access.log file. However, on Netscape it is caching the gif file in /htdocs/images and not caching the html files, not good. I can verify this because I see only one entry with the gif and it's associated cookie info per page. If I do a repeat visit to a page the gif file in /htdocs/images and it's cookie info does not get logged again. Does anyone know to beat the cache on Netscape, below is the relevant portion of my httpd.conf file. Any help would be greatly appreciated. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\" " combined CustomLog logs/access.log combined CookieTracking on CookieExpires "4 years" CookieName "agent_it" Header set Cache-Control private Header append Cache-Control no-cache="Set-Cookie" Header append Cache-Control max-age=1 ExpiresActive On ExpiresByType image/gif A1 Thanks, John P.
Re: I'm missing something in Apache::Cookie
Michael ([EMAIL PROTECTED]) said something to this effect: > H. > > When I retrieve a cookie > > %cookies = Apache::Cookie->fetch; > > I get a hash that contains the name of the cookie as the key and a > scalar reference as the value. > Apache::Cookie=SCALAR(0xblah...) > Can't seem to unravel it to get at the > value. Using > > %xx = Apache::Cookie->parse($val); > gives an apparently empty hash, yet retrieving the headers via > Apache::Table yields the correct results > > Cookie=foo=bar > > cook name val >foo bar > > > So what am I doing wrong with Apache::Cookie that keeps me from > returning the cookie value. This should do it: my $ac = Apache::Cookie->new($r); my $cookies = $ac->fetch; my %cookies = (); for (keys %{$cookies}) { $cookies{$_} = $cookies->{$_}->value; } However, I always find it easier to fetch cookies like this: my $cookies = { map { $1 => $2 if (/([^=]+)=(.*)/) } grep !/^$/, split /;\s*/, $r->header_in('cookie') }; $r->pnotes('cookies', $cookies); No messing with objects or any of that stuff. Putting it into pnotes makes the hashref accessible to other phases or subroutines easily (you only have to pass $r). (That's why I use a hashref and not a hash, so I can just put it directly into pnotes.) (darren) -- If you wish to drown, do not torture yourself with shallow water.
Re: I'm missing something in Apache::Cookie (fwd)
"Thomas S. Brettin" <[EMAIL PROTECTED]> writes: > from the looks of the code you guys posted, I would guess that > Cookie->fetch returns a hash reference, not a hash. Could this be the > problem? > It can return either a hash or a hash reference, depending on whether or not you wantarray. The problem many people encounter is that the values in the returned hash(ref) are Apache::Cookie OBJECTS, not simply value of the cookie. There's more to a cookie than just it's value. I think it goes something like this. %cookies = Apache::Cookie->fetch; print ref \%cookies; # prints HASH ?? print ref $cookies{'SESSION'}; # prints Apache::Cookie ?? print $cookies{'SESSION'}->value; # prints the value of SESSION cookie RTFM to be sure, or run it and see what you get! -- Joe Schaefer [EMAIL PROTECTED] SunStar Systems, Inc.
Re: I'm missing something in Apache::Cookie (fwd)
from the looks of the code you guys posted, I would guess that Cookie->fetch returns a hash reference, not a hash. Could this be the problem? Thomas S. Brettin Staff Member Bioscience Division, MS-M888 Los Alamos National Laboratory Los Alamos, NM 87545 505-665-3334 On Fri, 15 Sep 2000, Chris Winters wrote: > * Michael ([EMAIL PROTECTED]) [000915 17:29]: > > H. > > > > When I retrieve a cookie > > > > %cookies = Apache::Cookie->fetch; > > > > I get a hash that contains the name of the cookie as the key and a > > scalar reference as the value. > > Apache::Cookie=SCALAR(0xblah...) > > Can't seem to unravel it to get at the > > value. Using > > > > %xx = Apache::Cookie->parse($val); > > gives an apparently empty hash, yet retrieving the headers via > > Apache::Table yields the correct results > > > > Cookie=foo=bar > > > > cook name val > >foo bar > > > > > > So what am I doing wrong with Apache::Cookie that keeps me from > > returning the cookie value. > > > > Michael > > The following seems to work for me in nabbing all the cookies sent and > putting them into a hashref $cookies > >my $cookies = {}; >my $cookie_info = Apache::Cookie->fetch; >foreach my $name ( keys %{ $cookie_info } ) { > $cookies->{ $name } = $cookie_info->{ $name }->value; >} > > HTH > > Chris > > -- > Chris Winters > Senior Internet Developerintes.net > [EMAIL PROTECTED] http://www.intes.net/ > Integrated hardware/software solutions to make the Internet work for you. >
Re: I'm missing something in Apache::Cookie
> > The following seems to work for me in nabbing all the cookies sent > > and putting them into a hashref $cookies > > > >my $cookies = {}; > >my $cookie_info = Apache::Cookie->fetch; > >foreach my $name ( keys %{ $cookie_info } ) { > > $cookies->{ $name } = $cookie_info->{ $name }->value; > >} > > > duh I should have seen that! The "value" is a name blessed into the Cookie package. It's not obvious from the documentation, perhaps the author could tweek it up for the next newbie victim. :-) Michael [EMAIL PROTECTED]
Re: I'm missing something in Apache::Cookie
* Michael ([EMAIL PROTECTED]) [000915 17:29]: > H. > > When I retrieve a cookie > > %cookies = Apache::Cookie->fetch; > > I get a hash that contains the name of the cookie as the key and a > scalar reference as the value. > Apache::Cookie=SCALAR(0xblah...) > Can't seem to unravel it to get at the > value. Using > > %xx = Apache::Cookie->parse($val); > gives an apparently empty hash, yet retrieving the headers via > Apache::Table yields the correct results > > Cookie=foo=bar > > cook name val >foo bar > > > So what am I doing wrong with Apache::Cookie that keeps me from > returning the cookie value. > > Michael The following seems to work for me in nabbing all the cookies sent and putting them into a hashref $cookies my $cookies = {}; my $cookie_info = Apache::Cookie->fetch; foreach my $name ( keys %{ $cookie_info } ) { $cookies->{ $name } = $cookie_info->{ $name }->value; } HTH Chris -- Chris Winters Senior Internet Developerintes.net [EMAIL PROTECTED] http://www.intes.net/ Integrated hardware/software solutions to make the Internet work for you.
I'm missing something in Apache::Cookie
H. When I retrieve a cookie %cookies = Apache::Cookie->fetch; I get a hash that contains the name of the cookie as the key and a scalar reference as the value. Apache::Cookie=SCALAR(0xblah...) Can't seem to unravel it to get at the value. Using %xx = Apache::Cookie->parse($val); gives an apparently empty hash, yet retrieving the headers via Apache::Table yields the correct results Cookie=foo=bar cook name val foo bar So what am I doing wrong with Apache::Cookie that keeps me from returning the cookie value. Michael
Re: Connect the dots on Apache::Cookie
On Fri, 18 Aug 2000, Christopher Louis Everett wrote: > Stas Bekman wrote: > > > > > > > I'm not sure how much this will be of a tutorial but try: > > >http://thingy.kcilink.com/modperlguide/porting/Starting_with_mod_cgi_Compatible.html > > > This is to say then, that one uses Apache::Cookie, just like one would > use CGI::Cookie? more or less, yes, but faster since its core is written in C/XS > Everett > > PS. Thanks for the mod_perl guide, I wouldn't be this far along without > it. You are very welcome :) _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://jazzvalley.com http://singlesheaven.com http://perlmonth.com perl.org apache.org
Re: Connect the dots on Apache::Cookie
Stas Bekman wrote: > > > I'm not sure how much this will be of a tutorial but try: > http://thingy.kcilink.com/modperlguide/porting/Starting_with_mod_cgi_Compatible.html > This is to say then, that one uses Apache::Cookie, just like one would use CGI::Cookie? Everett PS. Thanks for the mod_perl guide, I wouldn't be this far along without it.
Re: Connect the dots on Apache::Cookie
On Fri, 18 Aug 2000, Christopher Louis Everett wrote: > Hello: > > Is there any more documentation besides the perldoc on > how to use Apache::Cookie (it's not enough for me :(, > I need something a bit more tutorially oriented, and > the Eagle Book doesn't cover it)? > > Thanks in advance. > > Christopher Everett > I'm not sure how much this will be of a tutorial but try: http://thingy.kcilink.com/modperlguide/porting/Starting_with_mod_cgi_Compatible.html _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://jazzvalley.com http://singlesheaven.com http://perlmonth.com perl.org apache.org
Connect the dots on Apache::Cookie
Hello: Is there any more documentation besides the perldoc on how to use Apache::Cookie (it's not enough for me :(, I need something a bit more tutorially oriented, and the Eagle Book doesn't cover it)? Thanks in advance. Christopher Everett
Re: segfault from Apache::Cookie and Apache::SSI
On Fri, 11 Aug 2000, G.W. Haywood wrote: > What compiler(s)? gcc -v says: gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
Re: segfault from Apache::Cookie and Apache::SSI
Hi again Perrin, On Thu, 10 Aug 2000, Perrin Harkins wrote: > I'm using Red Hat's Perl RPM, but Apache/mod_perl is compiled > from source. What compiler(s)? 73, Ged.
Re: segfault from Apache::Cookie and Apache::SSI
On Fri, 11 Aug 2000, G.W. Haywood wrote: > DSO or static? Static. I'm using Red Hat's Perl RPM, but Apache/mod_perl is compiled from source. - Perrin
Re: segfault from Apache::Cookie and Apache::SSI
Hi Perrin, On Thu, 10 Aug 2000, Perrin Harkins wrote: > I'm getting repeatable segfaults (every time) by feeding a simple > file to Apache::SSI. DSO or static? 73, Ged.
segfault from Apache::Cookie and Apache::SSI
I'm getting repeatable segfaults (every time) by feeding a simple file to Apache::SSI. It does a virtual include and then calls a perl sub that creates a new Apache::Cookie object, at which point it segfaults. I've reduced my test case to this: It doesn't matter what's in foo.shtml (right now I have a single "X"), but it does matter that it gets handled by Apache::SSI. If foo.shtml is not handled by Apache::SSI, everything is fine. I'm trying to reduce my test further, but does anyone have any ideas of what I should look at? I'm running perl 5.005, Apache 1.3.12, mod_perl 1.24, Apache::SSI 2.13, Apache::Cookie 0.01 (from libapreq 0.31) on Linux (Red Hat 6.2). - Perrin
Re: install Apache::Cookie for Win32?
"Russell Lundberg" <[EMAIL PROTECTED]> 6/17/00 12:01:17 PM >>> >>> Thanks Randy for the perl-win32-bin-0.6.exe binary. On Thu, 22 Jun 2000, Tom Roche wrote: >> Indeed! I bow in the general direction of Winnipeg. A few tweaks to >> httpd.conf-perl, install the service per >> http://apache.org/docs/windows.html and Apache::Hello is doing its >> thing on w2k. >> However, the site that I want to port from Solaris Apache to >> Windows Apache uses Apache::Cookie >> I get >>> [error] Can't locate loadable object for module Apache::Cookie in >>> @INC ... at d:/ProgramFiles/Perls/GNU/site/5.6.0/lib/mod_perl.pm >>> line 14 >> After a bit of research, I'm wondering: >> ? Is this libapreq related? If so, is there a libapreq for win32? Randy Kobes <[EMAIL PROTECTED]> 6/22/00 4:45:12 PM >>> > Apache::Cookie comes in the libapreq package, so you > do need this installed. I'm not aware of anyone being able > to build this on Win32 - I tried, but without success. > But it would be quite useful to have - I'll try again. Thanks! Your efforts are appreciated. Also, just wondering: would a "back port" from Apache::Cookie back to CGI::Cookie likely degrade mod_perl's performance too greatly? Unfortunately, at present our site needs to work with an external redirector (WRAP) that requires cookies. TIA, [EMAIL PROTECTED]
Re: install Apache::Cookie for Win32? was: mod_perl setup for w2k?
On Thu, 22 Jun 2000, Tom Roche wrote: > Tom Roche 6/16/00 6:52PM > >> I`ve also found Randy Kobes` mod_perl binaries at > >> ftp://theoryx5.uwinnipeg.ca/pub/other/ > > >> and am planning to try perl-win32-bin-0.6.exe. If anyone has already > >> gotten mod_perl running on w2k, I`d appreciate your recommendations > >> (or pointers to documentation) > > "Russell Lundberg" <[EMAIL PROTECTED]> 6/17/00 12:01:17 PM >>> > > I got Randy's mod_perl binary running on my Thinkpad 600 with no > > problem. You'll be surprised how easy it is. > > > Thanks Randy for the perl-win32-bin-0.6.exe binary. > > Indeed! I bow in the general direction of Winnipeg. A few tweaks to > httpd.conf-perl, install the service per > http://apache.org/docs/windows.html > and Apache::Hello is doing its thing on w2k. Hi, That's great to hear . > However, the site that I want to port from Solaris Apache to Windows > Apache uses Apache::Cookie, so I got > > [error] Can't locate Apache/Cookie.pm in @INC > in the error_log. I was unable to install the module using CPAN.pm [ ... ] > After a bit of research, I'm wondering: > ? Is this libapreq related? If so, is there a libapreq for win32? I've > seen the ominous > > Re: failure: libapreq + win32 > Doug MacEachern ([EMAIL PROTECTED]) > Mon, 10 May 1999 14:40:20 -0700 (PDT) > > and am hoping someone's gotten this working in the past year (oh > please :-) Otherwise, is there a workaround? Apache::Cookie comes in the libapreq package, so you do need this installed. I'm not aware of anyone being able to build this on Win32 - I tried, but without success. But it would be quite useful to have - I'll try again. > Also (admittedly offtopic): can anyone provide assistance with getting > CPAN.pm to run on a non-ActivePerl win32, such as the 5.6 provided > with the Kobes install? Pointers to resources would be appreciated. I set up the CPAN.pm in the mod_perl binary to use tar and gzip - does this combination work, rather than ncftpget? The tar.ex and gzip.exe binaries I used are in the same location as the mod_perl binary. Some fiddling with CPAN.pm's Config.pm file might be necessary if you use different locations and/or different paths than the defaults in Config.pm. If you send me a copy (off the list) of the error message you're getting, I'll try to see if something looks familiar best regards, randy kobes
install Apache::Cookie for Win32? was: mod_perl setup for w2k?
Tom Roche 6/16/00 6:52PM >> I`ve also found Randy Kobes` mod_perl binaries at >> ftp://theoryx5.uwinnipeg.ca/pub/other/ >> and am planning to try perl-win32-bin-0.6.exe. If anyone has already >> gotten mod_perl running on w2k, I`d appreciate your recommendations >> (or pointers to documentation) "Russell Lundberg" <[EMAIL PROTECTED]> 6/17/00 12:01:17 PM >>> > I got Randy's mod_perl binary running on my Thinkpad 600 with no > problem. You'll be surprised how easy it is. > Thanks Randy for the perl-win32-bin-0.6.exe binary. Indeed! I bow in the general direction of Winnipeg. A few tweaks to httpd.conf-perl, install the service per http://apache.org/docs/windows.html and Apache::Hello is doing its thing on w2k. However, the site that I want to port from Solaris Apache to Windows Apache uses Apache::Cookie, so I got > [error] Can't locate Apache/Cookie.pm in @INC in the error_log. I was unable to install the module using CPAN.pm (seems to be a combination of server directories not being where CPAN.pm wants them to be, and the win32 ncftpget.exe not taking the switches CPAN.pm wants to give it), so I copied the .../Apache.pm and .../Apache/*.pm from the working Solaris site. Now I get > [error] Can't locate loadable object for module Apache::Cookie in > @INC ... at d:/ProgramFiles/Perls/GNU/site/5.6.0/lib/mod_perl.pm > line 14 which is > if ($ENV{MOD_PERL}) { > (defined &{$class.'::bootstrap'} ? > \&{$class.'::bootstrap'} : > \&DynaLoader::bootstrap)-> > ($class, $version); > } After a bit of research, I'm wondering: ? Is this libapreq related? If so, is there a libapreq for win32? I've seen the ominous Re: failure: libapreq + win32 Doug MacEachern ([EMAIL PROTECTED]) Mon, 10 May 1999 14:40:20 -0700 (PDT) and am hoping someone's gotten this working in the past year (oh please :-) Otherwise, is there a workaround? ? If not, what's wrong? ? Is there a win32 installer for Apache::Cookie out there anywhere? Also (admittedly offtopic): can anyone provide assistance with getting CPAN.pm to run on a non-ActivePerl win32, such as the 5.6 provided with the Kobes install? Pointers to resources would be appreciated. Please reply directly to me as well as the list/group (I'm on the digest), and TIA, [EMAIL PROTECTED]
Re: Apache::Cookie problems
> > But while Recovering the Cookie I got some errors: > > $cookie_ref = Apache::Cookie->fetch; any difference if you change that to: my $r = Apache->request; my $cookies = Apache::Cookie->new($r)->parse; ?
Re: Apache::Cookie problems
Hi! > get-cookie.html > -- > <% > use Apache::Cookie; > my $cookie_ref = Apache::Cookie->fetch; > my $conf_cookie = $cookie_ref->{conf}; > my %hash = $conf_cookie->value; ^^^ thats it, now I understand! many thanks, it was too late last night for me ;-) Nevertheless I now store the values in a tied Apache::Session-hash, because so nobody can access my internal variables by setting an own cookie :-) If someone want to relax from hard coing work: Visit http://www.assoziations-blaster.de/english/ (cookies are set for the user's config). It's an Non-Commercian net.art project, the main feature is real-time linking of Texts, completely written in mod_perl :-) Ciao Alvar -- Alvar Freude [EMAIL PROTECTED] Besuche den Assoziations-Blaster: http://www.assoziations-blaster.de/
First argument to Apache::Cookie->new
I have noticed that although it is required to pass $r to Apache::Cookie->new() as the first argument, it appears that no type checking is performed. In other words, if I pass anything else as the first arg, no error is reported. However the subsequent call to $cookie->as_string will result in an empty string. I wonder if it is possible to do a simple type checking there, since this is the biggest difference from CGI::Cookie, and for people familiar with CGI::Cookie it would be a nice debugging info. Thanks very much. Fred Xia
Re: Apache::Cookie problems
perldoc Apache::Cookie says value Get or set the values of the cookie: 1.my $value = $cookie->value; 2.my @values = $cookie->value; 3.$cookie->value("string"); 4.$cookie->value(\@array); so if you set a array ref in 4 you retrieve it as in 2 extrapolating that I hope if you set a hash ref with value you should get a hash back with value. The the same happens. the following two snippets (set and get cookie) demonstrates that> set-cookie.html --- <% value use Apache; use Apache::Cookie; my $hash_ref = { 'AGE' => 30, 'SEX' => 'M' }; my $r = Apache->request; my $c = Apache::Cookie->new($r, -name=> 'conf', -value => $hash_ref, -expires => '+30m', -path=> '/' ); $c->bake; %> --- get-cookie.html -- <% use Apache::Cookie; my $cookie_ref = Apache::Cookie->fetch; my $conf_cookie = $cookie_ref->{conf}; my %hash = $conf_cookie->value; my $hash_ref = \%hash; %> cookie 'conf' has value <% print $conf_cookie %> hash reference is <% print $hash_ref %> content of cookie: AGE: <% print $hash{'AGE'} %> SEX: <% print $hash{'SEX'} %> Alvar Freude wrote: > > Hi, > > I have some problems in setting and getting back Cookie Values with > Apache::Cookie. > > I'm setting a cookie with Apache::Cookie and it seems that the cookie is > set correct: > > my $c = Apache::Cookie->new($r, > -name=> 'conf', > -value => $hash_ref, > -expires => '+30D', > -path => '/' > ); > $c->bake; > > But while Recovering the Cookie I got some errors: > > $cookie_ref = Apache::Cookie->fetch; > > Now $cookoe_ref->{conf} contains not a reference to the old values, it > contains a skalar like "Apache::Cookie=SCALAR(0x8b675b8)", but no > hashref ... > > Whats going on? It seems that I'm too stupid, argl! > > The CGI::Cookie-POD only sais: > >fetch returns an associative array consisting of all >cookies returned by the browser. The keys of the array >are the cookie names. > > OK, OK, but what's with the Values of the Hash? > How can I get the Cookie Values back? > > Whats going wrong? > > Thanx and Ciao > Alvar
Apache::Cookie problems
Hi, I have some problems in setting and getting back Cookie Values with Apache::Cookie. I'm setting a cookie with Apache::Cookie and it seems that the cookie is set correct: my $c = Apache::Cookie->new($r, -name=> 'conf', -value => $hash_ref, -expires => '+30D', -path=> '/' ); $c->bake; But while Recovering the Cookie I got some errors: $cookie_ref = Apache::Cookie->fetch; Now $cookoe_ref->{conf} contains not a reference to the old values, it contains a skalar like "Apache::Cookie=SCALAR(0x8b675b8)", but no hashref ... Whats going on? It seems that I'm too stupid, argl! The CGI::Cookie-POD only sais: fetch returns an associative array consisting of all cookies returned by the browser. The keys of the array are the cookie names. OK, OK, but what's with the Values of the Hash? How can I get the Cookie Values back? Whats going wrong? Thanx and Ciao Alvar
Diff between Apache::Cookie and CGI::Cookie
Can anyone tell what's the difference between Apache::Cookie and CGI::Cookie? The eagle book has examples of using CGI::Cookie. Thanks. Fred Xia __ Get Your Private, Free Email at http://www.hotmail.com
SOLVED?: mod_rewrite and Apache::Cookie bug?
All, ok, I think I nailed down the problem... given the uri translation (by either mod_rewrite or PerlTransHandler) / --> /perl-bin/test.cgi the code below will, by default parse cookies whose path matches / but bake cookies whose path matches /perl-bin adding -path => "/", to the new cookie kinda solves my problem, but I am wondering if this behavior is appropriate? just curious... --Geoff ## test.cgi code snip... my %cookies = Apache::Cookie->new($r)->parse; foreach (sort keys %cookies) { my $cookie = $cookies{$_}; warn "$cookie->name, $cookie->value;"; } my $cookie = Apache::Cookie->new($r, -name=> 'foo', -value => 'bar', -expires => '+10y' ); $cookie->bake; ## end > -Original Message- > From: Geoffrey Young [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 20, 2000 12:28 PM > To: '[EMAIL PROTECTED]' > Subject: RE: mod_rewrite and Apache::Cookie > > > for anyone interested... > > I wrote a PerlTransHandler and removed mod_rewrite and am > seeing the same > problem as outlined below... > > can anyone verify this? > > --Geoff > > > -Original Message- > > From: Geoffrey Young > > Sent: Wednesday, January 19, 2000 9:27 AM > > To: '[EMAIL PROTECTED]' > > Subject: mod_rewrite and Apache::Cookie > > > > > > hi all.. > > > > I've noticed that using mod_rewrite with Apache::Cookie > > exhibits odd behavior... > > > > scenario: > > foo.cgi uses Apache::Cookie to set a cookie > > mod_rewite writes all requests for index.html to > > /perl-bin/foo.cgi > > > > problem: > > access to /perl-bin/foo.cgi sets the cookie properly > > access to / or index.html runs foo.cgi, and attempts > > to set the cookie, but $cookie->bake issues the generic: > > Warning: something's wrong at > > /usr/local/apache/perl-bin/foo.cgi line 34. > > > > While I know I can use a PerlTransHandler here (and probably > > will now), does anyone have any ideas about this behavior? > > > > In the meanwhile, if I find out anything more while > > investigating, I'll post it... > > > > --Geoff > > >
RE: mod_rewrite and Apache::Cookie
for anyone interested... I wrote a PerlTransHandler and removed mod_rewrite and am seeing the same problem as outlined below... can anyone verify this? --Geoff > -Original Message- > From: Geoffrey Young > Sent: Wednesday, January 19, 2000 9:27 AM > To: '[EMAIL PROTECTED]' > Subject: mod_rewrite and Apache::Cookie > > > hi all.. > > I've noticed that using mod_rewrite with Apache::Cookie > exhibits odd behavior... > > scenario: > foo.cgi uses Apache::Cookie to set a cookie > mod_rewite writes all requests for index.html to > /perl-bin/foo.cgi > > problem: > access to /perl-bin/foo.cgi sets the cookie properly > access to / or index.html runs foo.cgi, and attempts > to set the cookie, but $cookie->bake issues the generic: > Warning: something's wrong at > /usr/local/apache/perl-bin/foo.cgi line 34. > > While I know I can use a PerlTransHandler here (and probably > will now), does anyone have any ideas about this behavior? > > In the meanwhile, if I find out anything more while > investigating, I'll post it... > > --Geoff >
mod_rewrite and Apache::Cookie
hi all.. I've noticed that using mod_rewrite with Apache::Cookie exhibits odd behavior... scenario: foo.cgi uses Apache::Cookie to set a cookie mod_rewite writes all requests for index.html to /perl-bin/foo.cgi problem: access to /perl-bin/foo.cgi sets the cookie properly access to / or index.html runs foo.cgi, and attempts to set the cookie, but $cookie->bake issues the generic: Warning: something's wrong at /usr/local/apache/perl-bin/foo.cgi line 34. While I know I can use a PerlTransHandler here (and probably will now), does anyone have any ideas about this behavior? In the meanwhile, if I find out anything more while investigating, I'll post it... --Geoff
Re: SegFaults caused by Apache::Cookie during ChildExit
On Wed, 22 Dec 1999, Clinton Gormley wrote: > I am using a home-baked session manager on my web site. I clean up > expired sessions by called a child exit handlder and this all worked > rather well. > > However, we have recompiled Perl, Apache, mod_perl and Perl modules with > pgcc and a different configuration (removed all modules we didn't need), > and now I get a SegFault when Apache::Cookie->new is called during a > ChildExit. > > I use Apache::Cookie in Authorization and PerlHandler phases without a > problem. > > Not sure whether this problem is caused by the compiler or the different > configuration at compile. > > Any ideas of starting points? Apache::Cookie needs a request_rec, there is no request_rec during ChildExit. this dependency could probably be loosened, but it won't work with the current version of libapreq.
SegFaults caused by Apache::Cookie during ChildExit
I am using a home-baked session manager on my web site. I clean up expired sessions by called a child exit handlder and this all worked rather well. However, we have recompiled Perl, Apache, mod_perl and Perl modules with pgcc and a different configuration (removed all modules we didn't need), and now I get a SegFault when Apache::Cookie->new is called during a ChildExit. I use Apache::Cookie in Authorization and PerlHandler phases without a problem. Not sure whether this problem is caused by the compiler or the different configuration at compile. Any ideas of starting points? Thanks Clint
Re: Apache::Cookie confusion
On 12/14/99 1:28 AM, Doug MacEachern wrote: > there is an Apache::Cookie in the libapreq bundle, which is supported > here. I'm not sure how another module named Apache::Cookie made it > onto CPAN. Worse, when you run the CPAN shell and do "install Apache::Cookie" you get the non-libapreq version. Ug! I'm guessing it has something to do with the fact that the libapreq version is "buried" whereas the "other" Apache::Cookie is a stand-alone sort of module. Hrm. -John
Re: Apache::Cookie v0.1 ?
On Sat, 27 Nov 1999, Rick Myers wrote: > Package namespace installedlatest in CPAN file > Apache::Cookie 0.01 0.1 L/LI/LIRAZ/Apache-Cookie-0.1.tar.gz > > I installed this beast yesterday along with a fresh CVS snapshot and > 1.3.9 tarball. It didn't "play well with others", failing with > complaints about missing bake(). I ended up manually removing it and > reinstalling libapreq. Is this just some sort of namespace clash? yes, it's a namespace clash, not sure how that happened.
Re: Apache::Cookie confusion
On Fri, 19 Nov 1999, John Siracusa wrote: > Apache::Cookie seems to have two different interfaces...or maybe there > are two different distributions of Apache::Cookie? Whatever it is, the > interface seems different on two machines here at work. One has 5.004 > and one has 5.005, but that shouldn't change the Apache::Cookie interface > should it? there is an Apache::Cookie in the libapreq bundle, which is supported here. I'm not sure how another module named Apache::Cookie made it onto CPAN.
Apache::Cookie v0.1 ?
Package namespace installedlatest in CPAN file Apache::Cookie 0.01 0.1 L/LI/LIRAZ/Apache-Cookie-0.1.tar.gz I installed this beast yesterday along with a fresh CVS snapshot and 1.3.9 tarball. It didn't "play well with others", failing with complaints about missing bake(). I ended up manually removing it and reinstalling libapreq. Is this just some sort of namespace clash? Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Apache::Cookie confusion
Apache::Cookie seems to have two different interfaces...or maybe there are two different distributions of Apache::Cookie? Whatever it is, the interface seems different on two machines here at work. One has 5.004 and one has 5.005, but that shouldn't change the Apache::Cookie interface should it? The interfaces are totally different. One uses set() and get(), either from an object or via Apache::Cookie->get(). The other purports to use the CGI::Cookie interface but only accepts the methods it documents itself: fetch(), bake(), etc. In my code, I "use Apache::Cookie" and then bang away trying to figure out what methods it supports. The result is that the code on machine1 that calls Apache::Cookie->get('mycookie') dies with an undefined subroutine error when run on machine2 (and vise versa for code on machine2 that uses fetch() and bake()). What am I missing here? I've done "force install Apache::Cookie" from the CPAN shell prompt several time to try to make sure everything is in sync, but the discrepancy still exists, and I still don't know what the correct interface to Apache::Cookie should be. My hunch is that the get() and fetch() versions are completely separate modules that both declare "package Apache::Cookie", but good old CPAN should allow that, should it? Can someone set me straight? -John P.S.-Documentation snippets from the two machines: On machine 1: % perldoc Apache::Cookie NAME The Apache::Cookie module - An OO interface to cookies based on CGI::Cookie, for use in mod_perl Apache modules. SYNOPSIS use Apache::Cookie; $r = Apache->request; # Object oriented $cookie = Apache::Cookie->new($r); $cookie->set(-name => 'cookie', -value => 'monster'); $value = $cookie->get('cookie'); ... On machine 2: % perldoc Apache::Cookie NAME Apache::Cookie - HTTP Cookies Class SYNOPSIS use Apache::Cookie (); my $cookie = Apache::Cookie->new($r, ...); DESCRIPTION The Apache::Cookie module is a Perl interface to the cookie routines in libapreq. The interface is based on Lincoln Stein's CGI::Cookie module. ...