Problem Installing Apache::Request and Apache::Test...
Dear Sir, I've statically compiled apache-1.3.31 and mod_perl-1.29 and now I need use Apache::Request in my scripts but the module is'nt present on my system. I've downloaded it from CPAN but 'perl Makefile.PL' results in error due to absence of needed version of Apache::Test module. Next i downloaded 'Apache::Test' and the two steps of 'perl Makefile.PL' and make are OK but 'make test' fails giving these output : ' query for SBINDIR failed query for TARGET failed query for SYSCONFDIR failed query for PREFIX failed . . etc. ' and [error] you are running the test under root etc. Please help me to solve this problem. I desperately need to install Apache::Request; Any feedback will be highly appreciated. Regards Rajesh __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
[mp2] netbsd 1.6.2, perl 5.8.4, apache 2.0.50, mod_perl 1.99_14 make test fails
Hi everybody, NetBSD-1.6.2, Apache-2.0.50, perl-5.8.4, mod_perl-1.99_14, standard istall from pkgsrc: Failed Test Stat Wstat Total Fail Failed List of Failed --- t/filter/both_str_con_add.t43 75.00% 2-4 t/protocol/echo_block.t32 66.67% 2-3 t/protocol/echo_filter.t 32 66.67% 2-3 k714% sudo make test TEST_VERBOSE=1 TEST_FILES="filter/both_str_con_add.t protocol/echo_block.t protocol/echo_filter.t" ===> *** No /usr/pkgsrc/distfiles/pkg-vulnerabilities file found, ===> *** skipping vulnerability checks. To fix, install ===> *** the pkgsrc/security/audit-packages package and run ===> *** '/usr/pkg/sbin/download-vulnerability-list'. ===> Testing for ap2-perl-1.99.14 cd "src/modules/perl" && /usr/bin/make -f Makefile.modperl /usr/pkg/bin/perl -Iblib/arch -Iblib/lib t/TEST -clean APACHE_TEST_GROUP= APACHE_TEST_HTTPD= APACHE_TEST_PORT= APACHE_TEST_USER= APACHE_TEST_APXS= /usr/pkg/bin/perl -Iblib/arch -Iblib/lib t/TEST -bugreport -verbose=1 filter/both_str_con_add.t protocol/echo_block.t protocol/echo_filter.t [warning] root mode: changing the files ownership to 'nobody' (32767:39) [warning] testing whether 'nobody' is able to -rwx /usr/pkgsrc/www/ap2-perl/work/mod_perl-1.99_14/t "/usr/pkg/bin/perl" -Mlib=/usr/pkgsrc/www/ap2-perl/work/mod_perl-1.99_14/Apache-Test/lib -MApache::TestRun -e 'eval { Apache::TestRun::run_root_fs_test(32767, 39, q[/usr/pkgsrc/www/ap2-perl/work/mod_perl-1.99_14/t]) }'; [warning] result: OK [warning] the client side drops 'root' permissions and becomes 'nobody' /usr/pkg/sbin/httpd -d /usr/pkgsrc/www/ap2-perl/work/mod_perl-1.99_14/t -f /usr/pkgsrc/www/ap2-perl/work/mod_perl-1.99_14/t/conf/httpd.conf -D APACHE2 using Apache/2.0.50 (prefork MPM) waiting 120 seconds for server to start: ..[Wed Jul 21 14:06:17 2004] [info] 28 Apache:: modules loaded [Wed Jul 21 14:06:17 2004] [info] 5 APR:: modules loaded [Wed Jul 21 14:06:17 2004] [info] base server + 17 vhosts ready to run tests .. waiting 120 seconds for server to start: ok (waited 7 secs) server localhost:8529 started server localhost:8530 listening (TestModperl::merge) server localhost:8531 listening (TestModperl::perl_options) server localhost:8532 listening (TestModperl::setupenv) server localhost:8533 listening (TestVhost::config) server localhost:8534 listening (TestProtocol::echo_filter) server localhost:8535 listening (TestProtocol::echo_timeout) server localhost:8536 listening (TestProtocol::echo_block) server localhost:8537 listening (TestPreConnection::note) server localhost:8538 listening (TestHooks::stacked_handlers2) server localhost:8539 listening (TestHooks::startup) server localhost:8540 listening (TestFilter::in_bbs_inject_header) server localhost:8541 listening (TestFilter::in_str_msg) server localhost:8542 listening (TestFilter::both_str_con_add) server localhost:8543 listening (TestFilter::in_bbs_msg) server localhost:8544 listening (TestDirective::perlmodule) server localhost:8545 listening (TestDirective::perlrequire) server localhost:8546 listening (TestPerl::ithreads) server localhost:8547 listening (TestDirective::perlloadmodule4) server localhost:8548 listening (TestDirective::perlloadmodule5) server localhost:8549 listening (TestDirective::perlloadmodule3) server localhost:8550 listening (TestDirective::perlloadmodule6) t/filter/both_str_con_add1..4 # Running under perl version 5.008004 for netbsd # Current time local: Wed Jul 21 14:06:24 2004 # Current time GMT: Wed Jul 21 10:06:24 2004 # Using Test.pm version 1.24 ok 1 # expected: mod_perl # received: mod_perl ok 2 # expected: 2.0 # received: not ok 3 # Failed test 3 in t/filter/both_str_con_add.t at line 22 fail #2 # t/filter/both_str_con_add.t line 22 is: ok t_cmp($str, $reply); # expected: rules # received: not ok 4 # Failed test 4 in t/filter/both_str_con_add.t at line 22 fail #3 FAILED tests 3-4 Failed 2/4 tests, 50.00% okay t/protocol/echo_block1..3 # Running under perl version 5.008004 for netbsd # Current time local: Wed Jul 21 14:06:25 2004 # Current time GMT: Wed Jul 21 10:06:25 2004 # Using Test.pm version 1.24 ok 1 # expected: hello # received: not ok 2 # Failed test 2 in t/protocol/echo_block.t at line 19 # t/protocol/echo_block.t line 19 is: ok t_cmp($_, $reply); # expected: world # received: not ok 3 # Failed test 3 in t/protocol/echo_block.t at line 19 fail #2 FAILED tests 2-3 Failed 2/3 tests, 33.33% okay t/protocol/echo_filter...1..3 # Running under perl version 5.008004 for netbsd # Current time local: Wed Jul 21 14:06:26 2004 # Current time GMT: Wed Jul 21 10:06:26 2004 # Using Test.pm version 1.24 ok 1 # expected: hello # received: not ok 2 # Failed test 2 in t/protocol/echo_filter.t at line 19 # t/protocol/echo_filter.t line 19 is: ok t_cmp($_, $reply); # expected: world # received: not ok 3
Re: Problem Installing Apache::Request and Apache::Test...
On Monday 19 July 2004, Rajesh Pethe wrote: > Dear Sir, > > I've statically compiled apache-1.3.31 and > mod_perl-1.29 and now I need use Apache::Request in > my scripts but the module is'nt present on my system. > I've downloaded it from CPAN but 'perl Makefile.PL' > results in error due to absence of needed version of > Apache::Test module. > > Next i downloaded 'Apache::Test' and the two steps of > 'perl Makefile.PL' and make are OK but 'make test' > fails giving these output : > ' > query for SBINDIR failed > query for TARGET failed > query for SYSCONFDIR failed > query for PREFIX failed > . > . > etc. ' > > and > > [error] you are running the test under root etc. > Read all the error message! [ error] You are running the test suite under user 'root'. Apache cannot spawn child processes as 'root', therefore we attempt to run the test suite with user 'nobody' (99:99). The problem is that the path (including all parent directories): /root/addon/Apache-Test-1.12/t must be 'rwx' by user 'nobody', so Apache can read and write under that path. There are several ways to resolve this issue. One is to move and rebuild the distribution to '/tmp/' and repeat the 'make test' phase. The other is not to run 'make test' as root (i.e. building under your /home/user directory). You can test whether some directory is suitable for 'make test' under 'root', by running a simple test. For example to test a directory '/root/addon/Apache-Test-1.12/t', run: % "/usr/bin/perl" -Mlib=lib -MApache::TestRun -e 'eval { Apache::TestRun::run_root_fs_test(99, 99, q[/root/addon/Apache-Test-1.12/t]) }'; Personally, I build it under /tmp, and it works fine. Use the same place for Apache::Request. Richard -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
RE: mod_perl regex conundrum
Hi again, Yes, I actually did a use Devel::SawAmpersand and it didn't see any evil variables. (Currently, our code isn't using the English package.) I ended up modifying our code so that it skips the regex I sent in my previous message on most requests. This circumvents the biggest part of our slow down, but it isn't completely solving the problem. We're still seeing code sluggishness on certain pages of our web app. The strange thing is that, in most cases, the same code runs as quickly as it did before our upgrade. It's just on a few pages of the web app that it slows down. We tried building Perl using Perl's malloc. Initial tests showed that this alleviated some of the memory bloating, but when we rebuilt some of our production web servers, the memory savings weren't realized. In fact, the Perls with -Dusemymalloc were using more memory. This, coupled with a warning in the Perl 5.8.3 INSTALL.Solaris file that said to never use -Dusemymalloc with gcc on Solaris after Perl 5.7 made us uncomfortable with this change, so we rolled it back. Devel::DProf and dprofpp were showing that some calls to CGI.pm were taking a good deal of time, so we're working on replacing them. This is not producing much of a speedup, however. We are also working to install the GTop module in our development environment. However, as we use Solaris, this is proving tricky because several prerequisite libraries are not present. (Thanks for helping my coworker, Peter Wood, with this, Stas.) Has anyone else successfully installed and used GTop on Solaris? We found most of these approaches by looking in Practical mod_perl and the mod_perl Developer's Cookbook. Are there any other suggestions that folks on the mailing list can offer us as we continue to troubleshoot this issue? Thanks again for your assistance. - Simon -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 2:54 PM To: Simon Miner Cc: mod_perl Mailing List ([EMAIL PROTECTED]) Subject: Re: mod_perl regex conundrum Simon Miner wrote: > Thanks for the suggestion! > > Between sawampersand and grep'ing my code, I did find an instance of $&. I > removed it, but I am still seeing the problem. Did you actually use Devel::SawAmpersand to test it? There are other modules that pull those in, e.g. if you do 'use English'. > I have also noticed that the size of our mod_perl processes has doubled > since the upgrade (from ~50M to ~100M). Did Perl, Apache, and mod_perl > really get that much bigger between the versions I mentioned in my last > email? Perl is getting bigger all the time but definitely not by this amount. Use Apache::Status coupled with all the goodies it invokes (B::Size etc) to figure out who eats your memory. If you have your perl built with ithreads (to check run: perl -V:useithreads), recompile it to not enable those (unless you plan to use them). You will find quite a few other performance/memory usage related tips in the "Practical mod_perl" book [1]. Also in your original report, the example of using Time::HiRes is highly unreliable. You need to count CPU clocks, not wallclocks. Use Benchmark.pm instead. Also have you tried using some special purpose CPAN module to do the parsing for you? e.g. I remember Randal's WebTechniques articles [2] have plenty of examples of using modules like HTML::Filter, HTML::Tree, etc. [1] http://modperlbook.org/ [2] http://www.stonehenge.com/merlyn/WebTechniques/ -- __ 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 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Can't set or modify ssl apache environment variables for user certificates
Hello, I am running Apache 2.0.49 with mod_perl, mod_ssl, on Windows 2000. The problem that I am trying to solve is to take a user's certificate, find out that information, and rewrite that information in the Apache Environment table. When the page I have finally loads, the client machine never receives the updated information and still gets the old information from the cert. Is there some scope of the perl module that I need to worry about? My only guess would be I need to do something special to modify the stuff in Apache through perl. How do I override that information in Apache? -Richard D. For debugging purposes, I print the information in Apache's standard error log. for example, here's some of my code: package Apache::Certmachine; use strict; use mod_perl(); use Apache(); use Apache::Constants qw(:common); use Net::LDAP; use Text::ParseWords; use MIME::Base64; use CGI qw(:standard); sub handler{ my $r =shift; return OK unless $r->is_main; my $key=""; # print the env variables foreach $key (sort(keys(%ENV)) { print STDERR "Before:$key = $ENV{$key}; } my $cn = $subr->subprocess_env('SSL_CLIENT_DN_CN'); my $dn = $subr->subprocess_env('SSL_CLIENT_DN'); #print the CN and DN from cert print STDERR "SSL_CLIENT_DN_CN: $CN"; print STDERR "SSL_CLIENT_DN: $DN"; #now try to reset the DN and CN with values $dn = "C=US, O=DISNEYLAND, CN=ETHAN MICHEAL HUNT"; $cn = "CN=ETHAN MICHEAL HUNT"; $subr - >subprocess_env->set(SSL_CLIENT_S_DN=>$dn); $subr - >subprocess_env->set(SSL_CLIENT_S_DN_CN=>$cn); #i can pull out this info again, and it appears to be # reset, but the client never gets this info. my $temp_dn = $subr->subprocess_env('SSL_CLIENT_S_DN'); print STDERR "new dn: $temp_dn"; my $temp_cn = $subr->subprocess_env('SSL_CLIENT_S_DN_CN'); print STDERR "new Cn: $temp_cn"; #print out all the std variables after the modssl $subr->subprocess_env(); foreach $key(sort keys(%ENV)) { print STDERR "After:$key = $ENV{$KEY} \N"; } } __ Do you Yahoo!? Vote for the stars of Yahoo!'s next ad campaign! http://advision.webevents.yahoo.com/yahoo/votelifeengine/ -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Method Handler not working
All, I have a quirky issue concerning a redhat machine and Apache 1. I have a method handler sub handler ($$) { my $class=shift; my $r = shift; } Which when running on a redhat linux machine dies with the error message "Attempt to bless into a reference" and when analysing the incoming variuables, $class is really $r. So apache seems to be ignoring the method handler directive. This error doesn't occur on machines running the same code (mirrored in the same way as the redhat box), it works perfectly fine. Has anybody seen this type of error before, is it the symptom of some other issue that I've missed somehow? Regards Marty ALL-NEW Yahoo! Messenger - so many all-new ways to express yourself
Re: Method Handler not working
On Thu, 2004-07-22 at 11:26, MARTIN MOSS wrote: > This error doesn't occur on machines running the same code (mirrored > in the same way as the redhat box), it works perfectly fine. > > Has anybody seen this type of error before, is it the symptom of some > other issue that I've missed somehow? Did you compile with support for method handlers? That has to be enabled. Also, are there any httpd.conf differences? - Perrin -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
ANNOUNCE: Krang SiteMap 1.00
We're pleased to announce that Krang SiteMap v1.00 has been released. Krang SiteMap is a Krang add-on for generating robot-friendly sitemaps to aid in Search Engine Optimization. SiteMap is designed to be easily integrated into existing Krang element libraries with minimal work. From the documentation: "The SiteMap element library addon to Krang is designed to make it easier for search robots to crawl your sites. Creating and publishing a SiteMap story at the root category of a site will result in a minimally formatted story listing every published story on the site." Download Krang SiteMap addon from the Krang add-on repository on the Krang website: http://krang.sourceforge.net/ - the Krang Team -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Method Handler not working
On Thu, 2004-07-22 at 12:06, MARTIN MOSS wrote: > There are no differences in code & http.conf between the working > machines, only OS versions. Okay, if the code and conf are the same, and method handlers are enabled as you told me off-list (don't do that), then I'm kind of at a loss. Is it the same version of Perl, mod_perl, and apache on both machines? - Perrin -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
RE: mod_perl regex conundrum
On Thu, 2004-07-22 at 10:40, Simon Miner wrote: > I ended up modifying our code so that it skips the regex I sent in my > previous message on most requests. This circumvents the biggest part of our > slow down, but it isn't completely solving the problem. We're still seeing > code sluggishness on certain pages of our web app. The strange thing is > that, in most cases, the same code runs as quickly as it did before our > upgrade. It's just on a few pages of the web app that it slows down. > > We tried building Perl using Perl's malloc. Why? Was it going into swap? > Devel::DProf and dprofpp were showing that some calls to CGI.pm were taking > a good deal of time, so we're working on replacing them. This is not > producing much of a speedup, however. Ironically, CGI.pm slows down CGI programs a lot (all of that code to compile), but doesn't hurt mod_perl programs much. > We are also working to install the GTop module in our development > environment. Why? Are you trying to get memory stats? You can probably just read from /proc, like Apache::SizeLimit does. > We found most of these approaches by looking in Practical mod_perl and the > mod_perl Developer's Cookbook. Are there any other suggestions that folks > on the mailing list can offer us as we continue to troubleshoot this issue? First, find out if you are running out of memory and going into swap. If you are, fix that with the techniques shown in the books. Next, figure out if there is something different about a slow request. You may need to install some extra logging so that you can tell which requests were slow and reproduce them later. If you can find a specific request that is always fast and another that is always slow, this should lead you to the source of the problem. You may have to debug in -X mode to solve this, since it could involve something about a request that leaves the server in a bad state for the next request. - Perrin -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: mod_perl regex conundrum
Simon Miner wrote: [...] We found most of these approaches by looking in Practical mod_perl and the mod_perl Developer's Cookbook. Are there any other suggestions that folks on the mailing list can offer us as we continue to troubleshoot this issue? If you can pinpoint the chunks of code that you find slow, I can try to look at those to optimize them. e.g the regex that you've mentioned. It's usually possible to rewrite the regex to make it faster. If you can setup a self contained package with Benchmark.pm using Geoff's Apache-Test skeleton (http://apache.org/~geoff/) -- that will save me a lot of time trying to reproduce the environment. Though I'm working on linux, but hopefully it shouldn't make much difference. -- __ 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 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] netbsd 1.6.2, perl 5.8.4, apache 2.0.50, mod_perl 1.99_14 make test fails
[EMAIL PROTECTED] wrote: Hi everybody, NetBSD-1.6.2, Apache-2.0.50, perl-5.8.4, mod_perl-1.99_14, standard istall from pkgsrc: Failed Test Stat Wstat Total Fail Failed List of Failed --- t/filter/both_str_con_add.t43 75.00% 2-4 t/protocol/echo_block.t32 66.67% 2-3 t/protocol/echo_filter.t 32 66.67% 2-3 Thanks for the detailed report, Mikhail. Could you please install the latest cvs and try again with it? http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution On the other hand if you aren't using protocol handlers you can safely proceed with 'make install'. But let's see if you get a better score with the current cvs. Thanks. -- __ 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 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
RPM of apache with static mod_perl and mod_ssl
Is anyone publicly maintaining a current apache (1.3 or 2.0) with a static mod_perl and mod_ssl? I've searched and not found such a thing. It would seem that it /should/ exist, but I haven't run across it. Does anyone have any pointers I'm missing? -- -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Can't set or modify ssl apache environment variables for user certificates
richard dinh wrote: Hello, I am running Apache 2.0.49 with mod_perl, mod_ssl, on Windows 2000. The problem that I am trying to solve is to take a user's certificate, find out that information, and rewrite that information in the Apache Environment table. When the page I have finally loads, the client machine never receives the updated information and still gets the old information from the cert. Is there some scope of the perl module that I need to worry about? My only guess would be I need to do something special to modify the stuff in Apache through perl. Why do you think you can do that at all? You can lookup, yes, but modify? Please correct me if I'm wrong. -- __ 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 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
[Fwd: ApacheCon US 2004: Call for Papers deadline extended!]
Let those modperl talk proposals come in en masse! Original Message Subject: ApacheCon US 2004: Call for Papers deadline extended! Date: Thu, 22 Jul 2004 18:32:06 +0200 From: Lars Eilebrecht <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] Call for Participation: ApacheCon US 2004 (CfP deadline extended!) = November 14-17, 2004, Las Vegas, Nevada, US [Please feel free to forward this notice far and wide!] NEW SUBMISSION DEADLINE: Monday, 2 August 2004, 23:59 EDT *** Notice NEW TIME: midnight Monday night, U.S. eastern time! *** Come share your knowledge of Apache software at this educational and fun-filled gathering of Apache users, vendors, and friends. Apache Software Foundation members are designing the technical program for ApacheCon US 2004 that will include over 40 sessions planned. We are particularly interested in session proposals covering: o Apache web server topics (installation, compilation, configuration, migration, ...) o All Apache Software Foundation projects (Jakarta, mod_perl, Xerces, SpamAssassin, et cetera) o scripting languages and dynamic content (Java, PHP, Perl, TCL, Python, XML, XSL, etc.) o Security and eCommerce o Performance tuning, load balancing, high availability o tips for writing Apache web server modules o Technical and non-technical case studies o new technologies (web, Java, XML, anti-spam) Only educational sessions related to projects of the Apache Software Foundation or the Web in general will be considered (commercial sales or marketing presentation won't be accepted; please contact [EMAIL PROTECTED] if you're interested in giving a vendor presentation). If you would like to be a speaker at the ApacheCon US 2004 event, please go to the ApacheCon Web site, log in, and choose the 'Submit a CFP' option from the list there: http://ApacheCon.Com/html/login.html NOTE: If you were a speaker or delegate at a past ApacheCon, please log in using the email address you used before; this will remember your information and pre-load the CFP form for you. If this is your first time being involved with ApacheCon, please create a new account. ALL SESSIONS WILL BE 50 MINUTES LONG! If you wish to propose a session that will take two consecutive slots, please mention that in the comments section of the CFP form. USE THE SAME FORM to submit a proposal for a half- or full-day tutorial. EXPENSES AND FEES are expected to be covered at approximately the same rate as for ApacheCon 2003 US; watch the ApacheCon site and the [EMAIL PROTECTED] and [EMAIL PROTECTED] mailing lists for news about the final details. Regards... -- Lars Eilebrecht - The Apache Software Foundation [EMAIL PROTECTED] -http://www.apachecon.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 signature.asc Description: PGP signature -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Can't set or modify ssl apache environment variables for user certificates
> > Why do you think you can do that at all? You can > lookup, yes, but > modify? Please correct me if I'm wrong. > > -- I don't know if it is possible. But I need to be able to change the values. What the rest my code does is get user cert, check against directory for a valid cert, check against LDAP directory for group, and I want to present this group membership info to an application. Right now the Client application receives the variable in one of those variables defined in MOD_SSL. This is the part I am trying to fix, so I need to be able to rewrite the CN or DN. -Richard __ Do you Yahoo!? Vote for the stars of Yahoo!'s next ad campaign! http://advision.webevents.yahoo.com/yahoo/votelifeengine/ -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Can't set or modify ssl apache environment variables for user certificates
richard dinh wrote: Why do you think you can do that at all? You can lookup, yes, but modify? Please correct me if I'm wrong. -- I don't know if it is possible. But I need to be able to change the values. What the rest my code does is get user cert, check against directory for a valid cert, check against LDAP directory for group, and I want to present this group membership info to an application. Right now the Client application receives the variable in one of those variables defined in MOD_SSL. This is the part I am trying to fix, so I need to be able to rewrite the CN or DN. So please figure out first whether you are allowed to do that (which I doubt, but I'm not 100% sure) and if you are, how do you do that. I don't think that changing the env tables is the way to go. Probably ask it as a general question (can I modify the client data and how do I do that), w/o mentioning perl, at the apache mod_ssl list: http://www.modssl.org/ -- __ 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 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
libapreq2 upload gotcha
I've been having problems getting uploads to work using libapreq2-2.03_04-dev. I finally have it working, but I thought I would post my story for the benefit of others. Originally I was doing the upload like this: my $bb = $r->upload('file')->bb(); open(OUT,">/tmp/test_file"); while (1) { my $b = $bb->first; last unless $b; $b->remove; my $data; $b->read($data); print OUT $data; } close OUT; Small files were working ok, but large files where being truncated at about 270k (which is suspiciously close to the 256k "zero copy limit" I saw mentioned on [EMAIL PROTECTED]). To make a long story short, here is the version that works: my $bb = $r->upload('file')->bb(); open(OUT,">/tmp/test_file"); while (1) { my $b = $bb->first; last unless $b; my $data; $b->read($data); print OUT $data; $b->remove; # <--- ta da! } close OUT; Notice that the only thing which changed was the position of the $b->remove call. Call it too soon and your upload is unreliable. Request for libapreq2 developers: Could you please either remove or document this gotcha? I also got upload->link to work, but I would have more confidence in that method (Request #2) if the default value of TEMP_DIR was documented. Mason does not currently provide a way to pass a TEMP_DIR to Apache::Request->new. ~ John Williams -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Method Handler not working
I'm not sure, is there a way to find out what options apache has been built with? There are no differences in code & http.conf between the working machines, only OS versions. MartyPerrin Harkins <[EMAIL PROTECTED]> wrote: On Thu, 2004-07-22 at 11:26, MARTIN MOSS wrote:> This error doesn't occur on machines running the same code (mirrored> in the same way as the redhat box), it works perfectly fine.> > Has anybody seen this type of error before, is it the symptom of some> other issue that I've missed somehow?Did you compile with support for method handlers? That has to beenabled. Also, are there any httpd.conf differences?- Perrin-- Report problems: http://perl.apache.org/bugs/Mail list info: http://perl.apache.org/maillist/modperl.htmlList etiquette: http://perl.apache.org/maillist/email-etiquette.html ALL-NEW Yahoo! Messenger - so many all-new ways to express yourself
Re: Method Handler not working
Perrin Harkins wrote: On Thu, 2004-07-22 at 11:26, MARTIN MOSS wrote: This error doesn't occur on machines running the same code (mirrored in the same way as the redhat box), it works perfectly fine. Has anybody seen this type of error before, is it the symptom of some other issue that I've missed somehow? Did you compile with support for method handlers? That has to be enabled. Also, are there any httpd.conf differences? right. Does your httpd.conf say SetHandler MyPackage::handler or SetHandler MyPackage Michael Peters Developer PlusThree -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Method Handler not working
Michael <[EMAIL PROTECTED]> wrote:Perrin Harkins wrote: > On Thu, 2004-07-22 at 11:26, MARTIN MOSS wrote: > >>This error doesn't occur on machines running the same code (mirrored >>in the same way as the redhat box), it works perfectly fine. >> >>Has anybody seen this type of error before, is it the symptom of some >>other issue that I've missed somehow? > > > Did you compile with support for method handlers? That has to be > enabled. Also, are there any httpd.conf differences? >right. Does your httpd.conf say >SetHandler MyPackage::handler >or >SetHandler MyPackage It is setup like this:- SetHandler perl-script PerlHandler My::Package Michael Peters Developer PlusThree ___ALL-NEW Yahoo! Messenger - so many all-new ways to express yourself http://uk.messenger.yahoo.com -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Method Handler not working
MARTIN MOSS wrote: Michael <[EMAIL PROTECTED]> wrote:Perrin Harkins wrote: On Thu, 2004-07-22 at 11:26, MARTIN MOSS wrote: This error doesn't occur on machines running the same code (mirrored in the same way as the redhat box), it works perfectly fine. Has anybody seen this type of error before, is it the symptom of some other issue that I've missed somehow? Did you compile with support for method handlers? That has to be enabled. Also, are there any httpd.conf differences? right. Does your httpd.conf say SetHandler MyPackage::handler or SetHandler MyPackage It is setup like this:- SetHandler perl-script PerlHandler My::Package Shouldn't that be PerlHandler My::Package->handler if you are doing method handlers. Is the config the same on the other boxes where it is working? Michael Peters Developer PlusThree -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: libapreq2 upload gotcha
John Williams <[EMAIL PROTECTED]> writes: [...] > Request for libapreq2 developers: Could you please either remove or > document this gotcha? The gotcha here is really a generic issue (ie working with bucket brigades through the APR:: modules) so maybe it is (or needs to be) addressed in the mp2 docs. However I wonder why you want to remove the buckets at all? With $upload->bb you probably shouldn't do that, because you're throwing data away that later modules/filters may yet want to use. Btw this is something that changed from 2.02 to 2.03 (we used to give you a copy of the brigade, so you *had* to remove the buckets yourself). There's also a new io() method coming in the coming 3.04-dev release that gives you a brigade copy like $upload->bb used to do, but it has a TIEHANDLE api superimposed. That way you can use perl's read() or <> operator to consume the buckets in $upload->io(). -- Joe Schaefer -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: libapreq2 upload gotcha
John Williams wrote: I've been having problems getting uploads to work using libapreq2-2.03_04-dev. I finally have it working, but I thought I would post my story for the benefit of others. Originally I was doing the upload like this: my $bb = $r->upload('file')->bb(); open(OUT,">/tmp/test_file"); while (1) { my $b = $bb->first; last unless $b; $b->remove; my $data; $b->read($data); print OUT $data; } close OUT; Small files were working ok, but large files where being truncated at about 270k (which is suspiciously close to the 256k "zero copy limit" I saw mentioned on [EMAIL PROTECTED]). Interesting. What's the type of the bucket? Is that a file bucket? Try this code: use APR::Brigade (); use APR::Bucket (); use APR::BucketType (); my $bb = $r->upload('file')->bb(); bb_dump($bb); sub bb_dump { my($bb) = @_; my @data; for (my $b = $bb->first; $b; $b = $bb->next($b)) { $b->read(my $bdata); push @data, $b->type->name, $bdata; } unless (@data) { print STDERR " No buckets\n"; return; } my $c = 1; while (my($btype, $data) = splice @data, 0, 2) { print STDERR "o bucket $c: $btype\n"; print STDERR "[$data]\n"; $c++; } } To make a long story short, here is the version that works: my $bb = $r->upload('file')->bb(); open(OUT,">/tmp/test_file"); while (1) { my $b = $bb->first; last unless $b; my $data; $b->read($data); print OUT $data; $b->remove; # <--- ta da! } close OUT; Notice that the only thing which changed was the position of the $b->remove call. Call it too soon and your upload is unreliable. -- __ 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 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: libapreq2 upload gotcha
Stas Bekman <[EMAIL PROTECTED]> writes: [...] > Interesting. What's the type of the bucket? Is that a file bucket? I believe so. File buckets morph into two buckets when you read from them. The current bucket transforms into a heap bucket, and a new file bucket is inserted behind *it*. However, if you remove the file bucket from the brigade *before* you read from it, the morphed file bucket created during the read winds up in limbo, not in the original brigade. -- Joe Schaefer -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: libapreq2 upload gotcha
Joe Schaefer wrote: Stas Bekman <[EMAIL PROTECTED]> writes: [...] Interesting. What's the type of the bucket? Is that a file bucket? I believe so. File buckets morph into two buckets when you read from them. The current bucket transforms into a heap bucket, and a new file bucket is inserted behind *it*. However, if you remove the file bucket from the brigade *before* you read from it, the morphed file bucket created during the read winds up in limbo, not in the original brigade. Thanks Joe. I'm going to update mp2 docs. You probably want to update apreq2 docs as well, to mention the potential problem. -- __ 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 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: libapreq2 upload gotcha
Stas Bekman wrote: Joe Schaefer wrote: Stas Bekman <[EMAIL PROTECTED]> writes: [...] Interesting. What's the type of the bucket? Is that a file bucket? I believe so. File buckets morph into two buckets when you read from them. The current bucket transforms into a heap bucket, and a new file bucket is inserted behind *it*. However, if you remove the file bucket from the brigade *before* you read from it, the morphed file bucket created during the read winds up in limbo, not in the original brigade. Thanks Joe. I'm going to update mp2 docs. Moving $b->remove to the end makes the code horribly kludgy. It's better to change the idiom to step through the buckets instead of removing them. Adjusting John's sample code: my $bb = $r->upload('file')->bb(); open(OUT,">/tmp/test_file"); for (my $b = $bb->first; $b; $b = $bb->next($b)) { $b->read(my $data); print OUT $data; } close OUT; Joe, does this idiom work fine with file buckets? We need to write a test for this case, but at the moment we have no API to create file buckets. I guess we could test that in an output filter and have a response handler call sendfile, which should create a bucket of file type. BTW, John you could also do: my $bb = $r->upload('file')->bb(); my $len = $bb->flatten(my $data); print OUT $data; though it's probably less memory-usage effective. -- __ 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 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: libapreq2 upload gotcha
Stas Bekman <[EMAIL PROTECTED]> writes: [...] > Moving $b->remove to the end makes the code horribly kludgy. It's > better to change the idiom to step through the buckets instead of > removing them. Adjusting John's sample code: > > my $bb = $r->upload('file')->bb(); > open(OUT,">/tmp/test_file"); > for (my $b = $bb->first; $b; $b = $bb->next($b)) { > $b->read(my $data); > print OUT $data; > } > close OUT; > > Joe, does this idiom work fine with file buckets? In principle this is fine, but there is a practical issue to consider: this idiom has the effect of reading the file bucket back into memory until there are no more file buckets left in the brigade. If the upload was large enough to warrant a spool file to begin with, slurping it all back into memory as chunks is not a good idea. What I'm going to recommend in the Apache::Upload docs is ask people to use the TIEHANDLE api for io() instead: my $io = $req->upload("foo")->io; print while read $io, $_, 8000; # read() will manage the buckets for you > We need to write a test for this case, but at the moment we have no > API to create file buckets. I guess we could test that in an output > filter and have a response handler call sendfile, which should create > a bucket of file type. > > BTW, John you could also do: > >my $bb = $r->upload('file')->bb(); >my $len = $bb->flatten(my $data); >print OUT $data; > > though it's probably less memory-usage effective. Hah, aren't *you* the guy that asked for $upload->slurp(my $data)? Now you're recommending $upload->bb->flatten, which does exactly the same thing (deja vu?). So, can we go back and get rid of slurp() now? :-) -- Joe Schaefer -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: libapreq2 upload gotcha
Joe Schaefer wrote: Stas Bekman <[EMAIL PROTECTED]> writes: [...] Moving $b->remove to the end makes the code horribly kludgy. It's better to change the idiom to step through the buckets instead of removing them. Adjusting John's sample code: my $bb = $r->upload('file')->bb(); open(OUT,">/tmp/test_file"); for (my $b = $bb->first; $b; $b = $bb->next($b)) { $b->read(my $data); print OUT $data; } close OUT; Joe, does this idiom work fine with file buckets? In principle this is fine, but there is a practical issue to consider: this idiom has the effect of reading the file bucket back into memory until there are no more file buckets left in the brigade. If the upload was large enough to warrant a spool file to begin with, slurping it all back into memory as chunks is not a good idea. What I'm going to recommend in the Apache::Upload docs is ask people to use the TIEHANDLE api for io() instead: my $io = $req->upload("foo")->io; print while read $io, $_, 8000; # read() will manage the buckets for you Do you mean the difference is in being able to request chunks of limited size (8k?). Otherwise the two are equivalent. May be we need to change the $b->read method to support an optional length argument, like apr_bucket_read does. In which case it'll be possible to do the same, w/o the TIEHANDLE interface. Though the user will need to manage the under/over-reads, which is a hassle. In addition TIEHANDLE adds an overhead, have you tried running a benchmark with these two chunks of code? We need to write a test for this case, but at the moment we have no API to create file buckets. I guess we could test that in an output filter and have a response handler call sendfile, which should create a bucket of file type. BTW, John you could also do: my $bb = $r->upload('file')->bb(); my $len = $bb->flatten(my $data); print OUT $data; though it's probably less memory-usage effective. Hah, aren't *you* the guy that asked for $upload->slurp(my $data)? Now you're recommending $upload->bb->flatten, which does exactly the same thing (deja vu?). So, can we go back and get rid of slurp() now? :-) While it's quite possible, I can't find myself suggesting that in the archives: http://marc.theaimsgroup.com/?l=apreq-dev&w=2&r=1&s=slurp&q=b Can you find the thread where it was discussed? In any case, I think $r->upload->slurp(my $data) is a goodness as it doesn't require the user to even be aware of the internal representation. But either of the two slurp techniques shouldn't be the recommended practice, as it will bloat memory. (Unless a user is going to read the whole thing into memory anyway). -- __ 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 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
startup.pl file not working
All, I have this in conf/httpd.conf: # Startup File: PerlRequire /home/darnold/modperl/startup.pl And: [EMAIL PROTECTED] apache]# cat /home/darnold/modperl/startup.pl # File: startup.pl use lib qw(/home/darnold/modperl/); 1; However, I am getting this in my error log: Can't locate OnlineTestingDB.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 /usr/local/lib/perl5/site_perl/5.6.2/i686-linux /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl .) Shouldn't @INC contain /home/darnold/modperl? -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Adding more locations to INC in startup.pl
All, Is this OK? # File: startup.pl use lib qw(/home/darnold/modperl/); use lib qw(/usr/local/apache/module/); 1; Where I've mkdir the module directory in /usr/local/apache. Can't test at the moment until I figure out my last question. Thanks. -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: startup.pl file not working
Hi, Is Apache allowed to change into this directory/read the file, try to move it to e.g. /tmp and see if it works. You could also insert a print-Statement and you should see the output on the console when apache is started (stop/start not restart). I'm not sure but I think a restart will not reload PerlRequire things. Maybe someone could correct me if I'm wrong. You could also test it using "apachectl configtest" and you should see the output. Tom David Arnold wrote: All, I have this in conf/httpd.conf: # Startup File: PerlRequire /home/darnold/modperl/startup.pl And: [EMAIL PROTECTED] apache]# cat /home/darnold/modperl/startup.pl # File: startup.pl use lib qw(/home/darnold/modperl/); 1; However, I am getting this in my error log: Can't locate OnlineTestingDB.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 /usr/local/lib/perl5/site_perl/5.6.2/i686-linux /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl .) Shouldn't @INC contain /home/darnold/modperl? Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Adding more locations to INC in startup.pl
Yes. David Arnold wrote: All, Is this OK? # File: startup.pl use lib qw(/home/darnold/modperl/); use lib qw(/usr/local/apache/module/); 1; Where I've mkdir the module directory in /usr/local/apache. Can't test at the moment until I figure out my last question. Thanks. Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: libapreq2 upload gotcha
Stas Bekman <[EMAIL PROTECTED]> writes: > Joe Schaefer wrote: > > Stas Bekman <[EMAIL PROTECTED]> writes: > > [...] > > > >>Moving $b->remove to the end makes the code horribly kludgy. It's > >>better to change the idiom to step through the buckets instead of > >>removing them. Adjusting John's sample code: > >> > >> my $bb = $r->upload('file')->bb(); > >> open(OUT,">/tmp/test_file"); > >> for (my $b = $bb->first; $b; $b = $bb->next($b)) { > >> $b->read(my $data); > >> print OUT $data; > >> } > >> close OUT; > >> [...] > > What I'm going to recommend in the Apache::Upload docs is ask people > > to use the TIEHANDLE api for io() instead: > > my $io = $req->upload("foo")->io; > > print while read $io, $_, 8000; # read() will manage the buckets for you > > Do you mean the difference is in being able to request chunks of > limited size (8k?). Otherwise the two are equivalent. No, they are not at all equivalent, because io *deletes* the buckets as it reads them, which puts them right back into the bucket allocator for immediate reuse. Witness: % CONTENT_TYPE="multipart/form-data; boundary=AaB03x" % PERL5OPT="-Mblib -MApache2 -MApache::Upload -MAPR::Bucket -MAPR::Pool" % export CONTENT_TYPE PERL5OPT % ls -sh ~/tmp/mfd_post_data 5.0M /home/joe/tmp/mfd_post_data % perl -wle '$r = Apache::Request->new(APR::Pool->new); \ $bb = $r->upload("pics")->bb; \ for ($b = $bb->first; $b; $b= $bb->next($b)) {$b->read($_)} \ system "ps u $$" ' < ~/tmp/mfd_post_data USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND joe 32201 0.0 0.4 38424 9952 ?S+ 05:34 0:00 perl -wle $r = Ap % perl -wle '$r = Apache::Request->new(APR::Pool->new); my $io = $r->upload("pics")->io; 1 while $io->read($_); system "ps u $$" ' < ~/tmp/mfd_post_data USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND joe 32203 0.0 0.2 33408 4908 ?S+ 05:36 0:00 perl -wle $r = Ap That's a difference of 5MB, or exactly one full copy of the upload file into RAM. This is because the for(...) loop transforms the sole file bucket into a string of heap buckets that aren't cleaned up until the pool goes away. [...] > In any case, I think $r->upload->slurp(my $data) is a goodness as it doesn't > require the user to even be aware of the internal representation. I was just teasing :-). Anyway's we can at least rip out the XS duplication in Apache::Upload and just write slurp in 2 lines of perl via bb->flatten. -- Joe Schaefer -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: libapreq2 upload gotcha
Joe Schaefer wrote: Stas Bekman <[EMAIL PROTECTED]> writes: Joe Schaefer wrote: Stas Bekman <[EMAIL PROTECTED]> writes: [...] Moving $b->remove to the end makes the code horribly kludgy. It's better to change the idiom to step through the buckets instead of removing them. Adjusting John's sample code: my $bb = $r->upload('file')->bb(); open(OUT,">/tmp/test_file"); for (my $b = $bb->first; $b; $b = $bb->next($b)) { $b->read(my $data); print OUT $data; } close OUT; [...] What I'm going to recommend in the Apache::Upload docs is ask people to use the TIEHANDLE api for io() instead: my $io = $req->upload("foo")->io; print while read $io, $_, 8000; # read() will manage the buckets for you Do you mean the difference is in being able to request chunks of limited size (8k?). Otherwise the two are equivalent. No, they are not at all equivalent, because io *deletes* the buckets as it reads them, which puts them right back into the bucket allocator for immediate reuse. Witness: % CONTENT_TYPE="multipart/form-data; boundary=AaB03x" % PERL5OPT="-Mblib -MApache2 -MApache::Upload -MAPR::Bucket -MAPR::Pool" % export CONTENT_TYPE PERL5OPT % ls -sh ~/tmp/mfd_post_data 5.0M /home/joe/tmp/mfd_post_data % perl -wle '$r = Apache::Request->new(APR::Pool->new); \ $bb = $r->upload("pics")->bb; \ for ($b = $bb->first; $b; $b= $bb->next($b)) {$b->read($_)} \ system "ps u $$" ' < ~/tmp/mfd_post_data USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND joe 32201 0.0 0.4 38424 9952 ?S+ 05:34 0:00 perl -wle $r = Ap % perl -wle '$r = Apache::Request->new(APR::Pool->new); my $io = $r->upload("pics")->io; 1 while $io->read($_); system "ps u $$" ' < ~/tmp/mfd_post_data USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND joe 32203 0.0 0.2 33408 4908 ?S+ 05:36 0:00 perl -wle $r = Ap That's a difference of 5MB, or exactly one full copy of the upload file into RAM. This is because the for(...) loop transforms the sole file bucket into a string of heap buckets that aren't cleaned up until the pool goes away. Doesn't it get transformed into HEAP buckets with io->read? static XS(apreq_xs_upload_brigade_read) Looks exactly the same internally as the perl for loop. The only difference is that it calls apr_bucket_delete when it's done with it. Which you can do with the for() loop just the same. In any case, I think $r->upload->slurp(my $data) is a goodness as it doesn't require the user to even be aware of the internal representation. I was just teasing :-). Anyway's we can at least rip out the XS duplication in Apache::Upload and just write slurp in 2 lines of perl via bb->flatten. And you need to load APR::Bucket, so it's better to keep it as it is. -0 on removal of $upload->slurp. -- __ 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 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: startup.pl file not working
Tom et al, OK. Permissions on startup.pl are: -rwx--1 darnold darnold 146 Jul 22 23:07 startup.pl But I am running Apache with user=darnold and group darnold. I put a print statement in startup.pl, which was a good idea by the way. # File: startup.pl use lib qw(/home/darnold/modperl/); use lib qw(/usr/local/apache/modules/); print "Starting up David's startup.pl file\n"; 1; Then I stopped and started Apache: [EMAIL PROTECTED] apache]# bin/apachectl stop bin/apachectl stop: httpd stopped [EMAIL PROTECTED] apache]# bin/apachectl start Starting up David's startup.pl file bin/apachectl start: httpd started And there's my print statement, so I'm excited. But, I have a little module in /home/darnold/modperl called WebDB.pm. [EMAIL PROTECTED] modperl]$ ll WebDB.pm -rw---1 darnold darnold 716 Jul 18 14:21 WebDB.pm It's the usual, with: package WebDB; # File: WebDB.pm use strict; use DBI; . . . 1; Now, I have a file in /usr/local/apache/cgi-bin/ that "uses" this module. #! /usr/local/bin/perl -w # File: Quiz1Solns.pl use strict; use WebDB; . . . But calling it from my browser causes: Can't locate WebDB.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 /usr/local/lib/perl5/site_perl/5.6.2/i686-linux /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl .) at /usr/local/apache/cgi-bin/Quiz1Solns.pl line 9. See, those two extra locations in my startup are not included in INC. If I do this, #! /usr/local/bin/perl -w # File: Quiz1Solns.pl use lib qw(/home/darnold/modperl/); use strict; use WebDB; . . . Then all is well. Hmmm Any suggestions? At 07:25 AM 7/23/04 +0200, Tom Schindl wrote: >Hi, > >Is Apache allowed to change into this directory/read the file, try to >move it to e.g. /tmp and see if it works. You could also insert a >print-Statement and you should see the output on the console when apache >is started (stop/start not restart). I'm not sure but I think a restart >will not reload PerlRequire things. Maybe someone could correct me if >I'm wrong. >You could also test it using "apachectl configtest" and you should see >the output. > >Tom > >David Arnold wrote: >> All, >> >> I have this in conf/httpd.conf: >> >> # Startup File: >> PerlRequire /home/darnold/modperl/startup.pl >> >> And: >> >> [EMAIL PROTECTED] apache]# cat /home/darnold/modperl/startup.pl >> # File: startup.pl >> >> use lib qw(/home/darnold/modperl/); >> 1; >> >> However, I am getting this in my error log: >> >> Can't locate OnlineTestingDB.pm in @INC (@INC contains: >> /usr/local/lib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 >> /usr/local/lib/perl5/site_perl/5.6.2/i686-linux >> /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl .) >> >> Shouldn't @INC contain /home/darnold/modperl? >> > > >Reclaim Your Inbox! >http://www.mozilla.org/products/thunderbird > >-- >Report problems: http://perl.apache.org/bugs/ >Mail list info: http://perl.apache.org/maillist/modperl.html >List etiquette: http://perl.apache.org/maillist/email-etiquette.html > > > -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: startup.pl file not working
Tom Schindl wrote: Hi, Is Apache allowed to change into this directory/read the file, try to move it to e.g. /tmp and see if it works. You could also insert a print-Statement and you should see the output on the console when apache is started (stop/start not restart). I'm not sure but I think a restart will not reload PerlRequire things. Maybe someone could correct me if I'm wrong. If I'm not wrong here's a doc-patch. You could also test it using "apachectl configtest" and you should see the output. Tom David Arnold wrote: All, I have this in conf/httpd.conf: # Startup File: PerlRequire /home/darnold/modperl/startup.pl And: [EMAIL PROTECTED] apache]# cat /home/darnold/modperl/startup.pl # File: startup.pl use lib qw(/home/darnold/modperl/); 1; However, I am getting this in my error log: Can't locate OnlineTestingDB.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 /usr/local/lib/perl5/site_perl/5.6.2/i686-linux /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl .) Shouldn't @INC contain /home/darnold/modperl? Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird Index: config.pod === RCS file: /home/cvspublic/modperl-docs/src/docs/1.0/guide/config.pod,v retrieving revision 1.18 diff -u -r1.18 config.pod --- config.pod 26 Nov 2003 08:40:10 - 1.18 +++ config.pod 23 Jul 2004 06:28:09 - @@ -665,6 +665,9 @@ C'd, it must return a I value. To ensure that this happens don't forget to add C<1;> at the end of I. +Modules and modification e.g. to C<@INC> loaded via these Directives are only +made if you issue a full stop/start, a restart is not sufficient. + =head2 Perl*Handlers As you probably know Apache traverses a loop for each HTTP request it -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: libapreq2 upload gotcha
Joe Schaefer wrote: Stas Bekman <[EMAIL PROTECTED]> writes: [...] Looks exactly the same internally as the perl for loop. The only difference is that it calls apr_bucket_delete when it's done with it. Which you can do with the for() loop just the same. But you didn't *write* that, so we must be talking past each other. I thought the problem this thread was really about was If I'm trying to read all the data in a bucket brigade, *when* is it ok to remove or delete a bucket from the brigade? The straightforward answer is that you should wait until after you've called $b->read(), because read() has all kinds of side effects. The rest of this dialog seems to have taken us nowhere, so I'll just stop here. OK. I did get something out of this discussion: one wants to delete the bucket to get allocation re-use (less memory, less CPU) (but not too soon, from where this thread has started). But since apreq's upload always deals with the file bucket, you could make it faster by not using apr_bucket_read, but bypass it and allocate less memory and be faster, no? -- __ 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 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: startup.pl file not working
Hi, you should have said that you are running as CGI. Here the modification using PerlRequire doesn't have any effects because you are starting a new perl-interpreter for every request. You should make a Apache::Registry-Script out of it, else you'll have to stick with use lib qw() in your .cgi. Tom David Arnold wrote: Tom et al, OK. Permissions on startup.pl are: -rwx--1 darnold darnold 146 Jul 22 23:07 startup.pl But I am running Apache with user=darnold and group darnold. I put a print statement in startup.pl, which was a good idea by the way. # File: startup.pl use lib qw(/home/darnold/modperl/); use lib qw(/usr/local/apache/modules/); print "Starting up David's startup.pl file\n"; 1; Then I stopped and started Apache: [EMAIL PROTECTED] apache]# bin/apachectl stop bin/apachectl stop: httpd stopped [EMAIL PROTECTED] apache]# bin/apachectl start Starting up David's startup.pl file bin/apachectl start: httpd started And there's my print statement, so I'm excited. But, I have a little module in /home/darnold/modperl called WebDB.pm. [EMAIL PROTECTED] modperl]$ ll WebDB.pm -rw---1 darnold darnold 716 Jul 18 14:21 WebDB.pm It's the usual, with: package WebDB; # File: WebDB.pm use strict; use DBI; . . . 1; Now, I have a file in /usr/local/apache/cgi-bin/ that "uses" this module. #! /usr/local/bin/perl -w # File: Quiz1Solns.pl use strict; use WebDB; . . . But calling it from my browser causes: Can't locate WebDB.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 /usr/local/lib/perl5/site_perl/5.6.2/i686-linux /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl .) at /usr/local/apache/cgi-bin/Quiz1Solns.pl line 9. See, those two extra locations in my startup are not included in INC. If I do this, #! /usr/local/bin/perl -w # File: Quiz1Solns.pl use lib qw(/home/darnold/modperl/); use strict; use WebDB; . . . Then all is well. Hmmm Any suggestions? At 07:25 AM 7/23/04 +0200, Tom Schindl wrote: Hi, Is Apache allowed to change into this directory/read the file, try to move it to e.g. /tmp and see if it works. You could also insert a print-Statement and you should see the output on the console when apache is started (stop/start not restart). I'm not sure but I think a restart will not reload PerlRequire things. Maybe someone could correct me if I'm wrong. You could also test it using "apachectl configtest" and you should see the output. Tom David Arnold wrote: All, I have this in conf/httpd.conf: # Startup File: PerlRequire /home/darnold/modperl/startup.pl And: [EMAIL PROTECTED] apache]# cat /home/darnold/modperl/startup.pl # File: startup.pl use lib qw(/home/darnold/modperl/); 1; However, I am getting this in my error log: Can't locate OnlineTestingDB.pm in @INC (@INC contains: /usr/local/lib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 /usr/local/lib/perl5/site_perl/5.6.2/i686-linux /usr/local/lib/perl5/site_perl/5.6.2 /usr/local/lib/perl5/site_perl .) Shouldn't @INC contain /home/darnold/modperl? Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html