%ENV with apache modperl API
Hi, i'm trying to substitute my old cgi %ENV with $r->headers_in ... (In my code $r is $apache) So i try this, but i get no entries for n the hash, why??? (modperl 2) (this code is used in a handler in the SSI phase) my %temp = $apache->headers_in; foreach (keys %temp) { print $temp{$_}; } # now what i'm used to do $apache -> subprocess_env->clear; $apache -> subprocess_env; In other part of the code i tried the next: $info->{host} = $apache->headers_in->get('REMOTE_HOST'); $info->{cookie} = $apache->headers_in->get('HTTP_COOKIE'); instead of the usual $info->{host} = $ENV{REMOTE_HOST}; $info->{cookie} = $ENV{HTTP_COOKIE}; But again it is not working. Am i doing any error? is this the way to "substitute" %ENV? Can i really substitute the %ENV or i must use it to have access to this data?? Thanks a lot. -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: %ENV with apache modperl API
Hi there, On Sat, 15 Nov 2003, [iso-8859-1] "SUCH SANMARTÍN, GERARD" wrote: > i'm trying to substitute my old cgi %ENV with > $r->headers_in ... > > my %temp = $apache->headers_in; Isn't $apache->headers_in a hashref? 73, Ged. -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Apache::SSIChain stops halfway through
Hi there, I've recently started converting many of the scripts on my Web site to use mod_perl in the interest of increasing performance. I've run into a strange problem with Apache::SSI -- only the first few SSIs are processed, while the rest show up as SSI tags in the document source. What's odd is that the placement of the SSI directives determines whether or not it gets parsed. If a directive is moved one line up, it gets processed. Is there a limit on the size of data chunks that can be parsed by Apache::SSI? Or a limit on the level that SSI directives can be nested? The source for the script is at http://www.hort.net/lists/perennials/index.txt while the script itself is at http://www.hort.net/lists/perennials/index.pl Note that only the first two SSI directives on the top-level page are processed. Here's my setup: Apache 1.3.29 mod_perl 1.29 perl 5.8.0 Apache::SSI 2.17 Apache::OutputChain 0.11 PerlSendHeader On SetHandler perl-script Options +ExecCGI PerlModule Apache::OutputChain Apache::SSIChain Apache::Registry PerlHandler Apache::OutputChain Apache::SSIChain Apache::Registry The results are the same if I switch to Apache::Filter. The SSI directives work fine with HTML files and in the old CGI scripts. Does anyone have any ideas? I'd love for this to work; our script processing time is 10x better with mod_perl than with our old CGI scripts. Thanks, Chris -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: %ENV with apache modperl API
Ged Haywood wrote: Hi there, On Sat, 15 Nov 2003, [iso-8859-1] "SUCH SANMART?N, GERARD" wrote: i'm trying to substitute my old cgi %ENV with $r->headers_in ... my %temp = $apache->headers_in; Isn't $apache->headers_in a hashref? Yes. It returns an APR::Table object, which is a also a tied hash reference. So you can use either the hash or the object API. (exactly the same as in mp1, though there the class was Apache::Table) http://perl.apache.org/docs/2.0/api/APR/Table.html There are many other methods which return APR::Table objects. Next time you encounter a problem, search the docs: http://perl.apache.org/search/swish.cgi?query=headers_in&sbm=SecI&submit=search Granted http://perl.apache.org/docs/2.0/api/Apache/RequestRec.html needs to have this info, but we didn't get around doing it yet. > my %temp = $apache->headers_in; > foreach (keys %temp) { > print $temp{$_}; > } this should be: my $temp = $apache->headers_in; foreach (keys %$temp) { print "$_ $temp->{$_}\n"; } you probably want to see the keys as well. > # now what i'm used to do > $apache -> subprocess_env->clear; you don't need to clear. > $apache -> subprocess_env; Yup, that populates %ENV, with things like $ENV{REMOTE_HOST}, familiar from mod_cgi. > In other part of the code i tried the next: > $info->{host} = $apache->headers_in->get('REMOTE_HOST'); > $info->{cookie} = $apache->headers_in->get('HTTP_COOKIE'); look at the dump of %$temp and you will see what headers the client gives to you. There is no header REMOTE_HOST, so of course you don't get it. Instead you should use $apache->get_remote_host(). And it's not HTTP_COOKIE but $apache->headers_in->get('Cookie'). Again look at the dump. __ 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 -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Perl 5.6.2 is out
FYI Original Message Subject: Perl 5.6.2 Date: Sat, 15 Nov 2003 14:00:12 +0100 From: Rafael Garcia-Suarez <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] When great or unexpected events fall out upon the stage of this sublunary word--the mind of man, which is an inquisitive kind of a substance, naturally takes a flight, behind the scenes, to see what is the cause and first spring of them--The search was not long in this instance. -- Sterne, Tristram Shandy, IV, xxvii This is perl 5.6.2. It will be available soon from your favourite CPAN mirror as http://www.cpan.org/authors/id/R/RG/RGARCIA/perl-5.6.2.tar.gz Its MD5 checksum is 6aa648d086ecda5400de3472dbe1ebfe. Thanks to everyone who helped me to build, test and fix this new maintainance release (and to everyone who provided the fixes for 5.8 that I backported into perl 5.6). The use.perl announcement will follow tomorrow. Enjoy, -- rgs -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Apache::AuthCookie failing tests
I use the development perl-server under my home directory named /home/ceverett/apache/bin/httpd-perl with user 'ceverett' and group 'ceverett' while I'm logged in as root. Not sure whats going on here ... I included the results of a "make test TEST_VERBOSE=1" below. t/httpd -f `pwd`/t/httpd.conf PERL_DL_NONLAZY=1 PORT=8228 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/lib/perl/5.8.2 -I/usr/share/perl/5.8.2 -e 'use Test::Harness qw(&runtests $verbose); $verbose=1; runtests @ARGV;' t/*.t t/real1..17 ok 1 ok 2 not ok 3 Result: Connection: close Date: Sat, 15 Nov 2003 22:29:11 GMT Accept-Ranges: bytes ETag: "0-0-3fb6a855" Server: Apache/1.3.28 (Unix) mod_perl/1.28 Content-Length: 0 Content-Type: text/html Last-Modified: Sat, 15 Nov 2003 22:27:33 GMT Client-Date: Sat, 15 Nov 2003 22:29:11 GMT Client-Peer: 127.0.0.1:8228 Client-Response-Num: 1 Expected: Get the protected document ok 4 code: 302 ok 5 not ok 6 Result: Connection: close Date: Sat, 15 Nov 2003 22:29:12 GMT Accept-Ranges: bytes ETag: "0-0-3fb6a855" Server: Apache/1.3.28 (Unix) mod_perl/1.28 Content-Length: 0 Content-Type: text/html Last-Modified: Sat, 15 Nov 2003 22:27:33 GMT Client-Date: Sat, 15 Nov 2003 22:29:12 GMT Client-Peer: 127.0.0.1:8228 Client-Response-Num: 1 Expected: Congratulations Congratulations, you got past AuthCookie Log Out ok 7 ok 8 ok 9 code: 403 ok 10 Location: /docs/protected/get_me.html Set-Cookie: Sample::AuthCookieHandler_WhatEver=programmer:Heroo; path=/ Code: 302 ok 11 ok 12 ok 13 Location: /docs/authany/get_me.html Set-Cookie: Sample::AuthCookieHandler_WhatEver=some-user:mypassword; path=/ Code: 302 ok 14 code: 403 ok 15 ok 16 ok 17 FAILED tests 3, 6 Failed 2/17 tests, 88.24% okay Failed Test Stat Wstat Total Fail Failed List of Failed --- t/real.t 172 11.76% 3 6 -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html