cvs commit: modperl-2.0/xs/ModPerl/Const Const.pm
dougm 2002/09/05 10:07:23 Modified:xs/ModPerl/Const Const.pm Log: fix typo which triggered bootstrap when running under mod_perl Revision ChangesPath 1.4 +1 -1 modperl-2.0/xs/ModPerl/Const/Const.pm Index: Const.pm === RCS file: /home/cvs/modperl-2.0/xs/ModPerl/Const/Const.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Const.pm 4 Sep 2002 17:10:15 - 1.3 +++ Const.pm 5 Sep 2002 17:07:23 - 1.4 -13,7 +13,7 sub dl_load_flags { DL_GLOBAL } #only bootstrap for use outside of mod_perl -unless (defined Modperl::Const::compile) { +unless (defined ModPerl::Const::compile) { __PACKAGE__-bootstrap($VERSION); }
cvs commit: modperl-2.0/src/modules/perl modperl_module.c
dougm 2002/09/05 11:05:52 Modified:src/modules/perl modperl_module.c Log: automate SvREFCNT-ing used with modperl_module_cmd_fetch a bit Revision ChangesPath 1.7 +9 -7 modperl-2.0/src/modules/perl/modperl_module.c Index: modperl_module.c === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_module.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- modperl_module.c 4 Sep 2002 17:11:22 - 1.6 +++ modperl_module.c 5 Sep 2002 18:05:52 - 1.7 -499,7 +499,10 { const char *errmsg = NULL; -*retval = Nullsv; +if (*retval) { +SvREFCNT_dec(*retval); +*retval = Nullsv; +} if (sv_isobject(obj)) { int count; -572,7 +575,7 cmds = apr_array_make(p, fill+1, sizeof(command_rec)); for (i=0; i=fill; i++) { -SV *val; +SV *val = Nullsv; STRLEN len; SV *obj = AvARRAY(module_cmds)[i]; modperl_module_cmd_data_t *info = modperl_module_cmd_data_new(p); -586,7 +589,6 } cmd-name = apr_pstrdup(p, SvPV(val, len)); -SvREFCNT_dec(val); if ((errmsg = modperl_module_cmd_fetch(aTHX_ obj, args_how, val))) { /* XXX default based on $self-func prototype */ -600,7 +602,6 cmd-args_how = modperl_constants_lookup_apache(SvPV(val, len)); } -SvREFCNT_dec(val); } if (!modperl_module_cmd_lookup(cmd)) { -614,7 +615,6 } else { info-func_name = apr_pstrdup(p, SvPV(val, len)); -SvREFCNT_dec(val); } if ((errmsg = modperl_module_cmd_fetch(aTHX_ obj, req_override, val))) { -628,7 +628,6 cmd-req_override = modperl_constants_lookup_apache(SvPV(val, len)); } -SvREFCNT_dec(val); } if ((errmsg = modperl_module_cmd_fetch(aTHX_ obj, errmsg, val))) { -638,7 +637,6 } else { cmd-errmsg = apr_pstrdup(p, SvPV(val, len)); -SvREFCNT_dec(val); } cmd-cmd_data = info; -646,7 +644,11 /* no default if undefined */ if (!(errmsg = modperl_module_cmd_fetch(aTHX_ obj, data, val))) { info-cmd_data = apr_pstrdup(p, SvPV(val, len)); +} + +if (val) { SvREFCNT_dec(val); +val = Nullsv; } }
Re: Seg Fault with PHP and Perl together
On Wed, 04 Sep 2002 18:17:44 +0100 Jon Harris [EMAIL PROTECTED] wrote: Hi I inherited a very happy cobalt raq3 with 2 sites using embedded Perl which work very well. There are about 20 sites on the box. I needed to get PHP running on the same box, so I made the module, added it into the httpd.conf and PHP was working fine - Except that it broke the perl sites. The http error log entry is: child pid 22610 exit signal Segmentation fault (11) - the client gets a 'page not found error'. All I have to do get perl working again is to comment out LoadModule php4_module /usr/lib/apache/libphp4.so (and) AddModule mod_php4.c and restart httpd, it works fine again, obviously minus the php Bearing in mind, I am on about page 3 of O'Reilly's Apache - The definitive Guide does anyone know the simplist way I can get it working? I don't need any sites to use both embperl and php together. This is a virtual site section in httpd.conf for one of the perl sites (anonymised) there is also a big Perl chunk in the httpd.conf, not sure if that is relevant here. * VirtualHost 0.0.0.0 ServerName thedomain.com ServerAdmin root DocumentRoot /home/sites/site42/web ServerAlias thedomain.com PerlModule Apache::DBI PerlModule HTML::Embperl PerlSetEnv EMBPERL_OPTIONS 8208 PerlSetEnv EMBPERL_ESCMODE 0 RewriteEngine on RewriteCond %{HTTP_HOST}!^0.0.0.0(:80)?$ RewriteCond %{HTTP_HOST}!^www.thedomain.com(:80)?$ RewriteRule ^/(.*) http://www.thedomain.com/$1 [L,R] RewriteOptions inherit #Files *.htm* #SetHandler perl-script #PerlHandler HTML::Embperl #Options ExecCGI #/Files AliasMatch ^/~([^/]+)(/(.*))? /home/sites/site42/users/$1/web/$3 AliasMatch ^/users/([^/]+)(/(.*))? /home/sites/site42/users/$1/web/$3 # AddHandler server-parsed .shtml # AddTypetext/html .shtml AddHandler cgi-wrapper .cgi AddHandler cgi-wrapper .pl /VirtualHost * It looks like perl and PHP are getting in each others way, should I try and make a new apache? what order should I do things in? Should I look for another job? :), I need to get it working quickly and with the minimum disruption to the server. Every time I try and do things like this on a RAQ something breaks something else, usually its the GUI and I get about 50 phone calls. If you must resolve urgently this problem, you can consider the possibility to proxy all mod_perl requests to an Apache/mod_perl enabled on a different port (also this save more memory). - Enrico
help getting started ..
Hi, I'm just getting started with mod_perl. Was trying out the Apache::CommandServer sample code provided in the documentation, but I seem to get this error : Can't locate object method run_access_checker via package Apache::RequestRec at . I'm using Apache 2.0.40, with mod_perl 2.0, Perl 5.8.0 on Red Hat Linux 7.2. Also, I was just reading up on the mod_perl handlers. Is it possible to modify the working of apache, such that, it doesn't close the connection with the client ? and the connection with the client remains a constant one until the client explicitly closes the connection ? Can this be done at a module level ? Or do I need to modify the Apache source to acomplish the same ? If its possible with mod_perl, which PerlHandler(s) need to be used ? Thanks a whole lot. I've just recently purchased Oreilly's Writing Apache Modules with Perl and C, but realized that it isn't too much of help, coz I'm dealing with Apache 2.0 the book is all about Apache 1.3 theres such a drastic difference between the two mod_perl implementations. Is there any other source of documentation / help I can find ? Thanks Again, Sylbert L PS : The Code that I'm using can be found at : http://perl.apache.org/docs/2.0/user/overview/overview.html#Apache__CommandS erver_Source
Re: help getting started ..
Sylbert L wrote: Hi, I'm just getting started with mod_perl. Was trying out the Apache::CommandServer sample code provided in the documentation, but I seem to get this error : Can't locate object method run_access_checker via package Apache::RequestRec at . add: use Apache::HookRun (); in mod_perl 2.0 methods are spread across many modules for the maximum performance and modularity. Once the API docs will be created you will just have to search for the method in question and load the module that has it. For now the easiest way is to grep the WrapXS dir: .../modperl-2.0 grep -Ir run_access_checker WrapXS WrapXS/Apache/HookRun/HookRun.xs:ap_run_access_checker(r) WrapXS/Apache/HookRun/HookRun.c:XS(XS_Apache__RequestRec_run_access_checker); /* prototype to pass -Wmissing-prototypes */ WrapXS/Apache/HookRun/HookRun.c:XS(XS_Apache__RequestRec_run_access_checker) WrapXS/Apache/HookRun/HookRun.c:Perl_croak(aTHX_ Usage: Apache::RequestRec::run_access_checker(r)); WrapXS/Apache/HookRun/HookRun.c:RETVAL = ap_run_access_checker(r); WrapXS/Apache/HookRun/HookRun.c: newXS(Apache::RequestRec::run_access_checker, XS_Apache__RequestRec_run_access_checker, file); I'm using Apache 2.0.40, with mod_perl 2.0, Perl 5.8.0 on Red Hat Linux 7.2. Also, I was just reading up on the mod_perl handlers. Is it possible to modify the working of apache, such that, it doesn't close the connection with the client ? and the connection with the client remains a constant one until the client explicitly closes the connection ? Can this be done at a module level ? Or do I need to modify the Apache source to acomplish the same ? If its possible with mod_perl, which PerlHandler(s) need to be used ? HTTP is a stateless protocol and while you have the KeepAlive functionality to serve several requests over the same connection, you cannot rely on that to keep the connection open. Most likely you need to write a protocol handler for that. See: http://perl.apache.org/docs/2.0/user/handlers/protocols.html for examples and explanations. Thanks a whole lot. I've just recently purchased Oreilly's Writing Apache Modules with Perl and C, but realized that it isn't too much of help, coz I'm dealing with Apache 2.0 the book is all about Apache 1.3 theres such a drastic difference between the two mod_perl implementations. Is there any other source of documentation / help I can find ? Yes. There is enough to keep you busy for quite a while: http://perl.apache.org/docs/2.0/user/index.html __ 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: help getting started ..
Thanks Stas, the code works just fine now. This is what i'd read : [Apache 1.3 is hardwired to speak only one protocol, HTTP. Apache 2.0 has moved to more of a server framework architecture making it possible to plugin handlers for protocols other than HTTP. The protocol module design also abstracts the transport layer so protocols such as SSL can be hooked into the server without requiring modifications to the Apache source code. This allows Apache to be extended much further than in the past, making it possible to add support for protocols such as FTP, SMTP, RPC flavors and the like. The main advantage being that protocol plugins can take advantage of Apache's portability, process/thread management, configuration mechanism and plugin API.] So if this is true, then shouldn't it be possible for me to implment a constant connection using Apache 2.0 ? Thanks again, Sylbert L PS : Any idea when the API docs will be available ? I'm using Apache 2.0.40, with mod_perl 2.0, Perl 5.8.0 on Red Hat Linux 7.2. Also, I was just reading up on the mod_perl handlers. Is it possible to modify the working of apache, such that, it doesn't close the connection with the client ? and the connection with the client remains a constant one until the client explicitly closes the connection ? Can this be done at a module level ? Or do I need to modify the Apache source to acomplish the same ? If its possible with mod_perl, which PerlHandler(s) need to be used ? HTTP is a stateless protocol and while you have the KeepAlive functionality to serve several requests over the same connection, you cannot rely on that to keep the connection open.
Re: help getting started ..
Sylbert L wrote: Thanks Stas, the code works just fine now. cool. I've fixed the online doc. This is what i'd read : [Apache 1.3 is hardwired to speak only one protocol, HTTP. Apache 2.0 has moved to more of a server framework architecture making it possible to plugin handlers for protocols other than HTTP. The protocol module design also abstracts the transport layer so protocols such as SSL can be hooked into the server without requiring modifications to the Apache source code. This allows Apache to be extended much further than in the past, making it possible to add support for protocols such as FTP, SMTP, RPC flavors and the like. The main advantage being that protocol plugins can take advantage of Apache's portability, process/thread management, configuration mechanism and plugin API.] So if this is true, then shouldn't it be possible for me to implment a constant connection using Apache 2.0 ? See my previous reply. You need to implement a protocol handler. Here is the URL again: http://perl.apache.org/docs/2.0/user/handlers/protocols.html PS : Any idea when the API docs will be available ? We want to reuse as much of the C headers Apache docs as possible, Lyle is working on writing a tool which will extract them. I'm not sure what's the status of things. Perhaps Lyle can give us an update. Meanwhile, if you aren't sure what APIs to use look in the t/ directory, where there are a few hundreds of tests that exercise most of the existing APIs. Overall 1.3 methods aren't very different in 2.0, there are just a bunch of new methods which are new. Also you can reuse the Apache C documentation as well. See: http://docx.webperf.org and http://lxr.webperf.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
handler invoking problems
I install apache 1.3.26 / modperl 1.27 with model_rewite module, but apache doesn't call my handler subroutine (i use Apache::PageKit) for root in my htdocs/: Request http://localhost/index works fine, but http://localhost/ shows me list of directories and files in my htdocs/ directory. Why? Here is my httpd.conf: httpd.conf (quotation): --- DocumentRoot /usr/local/apache-new/htdocs PerlSetEnv AppConfig /usr/local/apache-new/conf/appconfig.conf PerlRequire appconfig.pl Directory / PerlSetVar PKIT_ROOT /usr/local/apache-new/htdocs PerlSetVar PKIT_SERVER staging SetHandler perl-script PerlHandler +Apache::PageKit Perl use lib /usr/local/apache-new/htdocs/lib/perl; Apache::PageKit-startup(/usr/local/apache-new/htdocs,staging); /Perl /Directory --- Thank you very much, Best wishes! Anton Permyakov Web-Developer [EMAIL PROTECTED] WWW.SOLUDIUM.COM
RE: User process ownership
Or if you really dont care about security maybe you could chmod 4755 the script, owned by root, to run as root. Just make sure that you clean all of the data you receive from the form. I kinda like the daemon idea that simran had. -Original Message- From: simran [mailto:[EMAIL PROTECTED]] Alternatively, you can write a daemon that runs as root that you can connect to that can do this...
[RFC] Apache::AuthDigest
a few months ago I posted an RFC for a Digest authentication module. http://marc.theaimsgroup.com/?l=apache-modperlm=102217847409606w=2 I've done a bit of work on it based on feedback and my own tinkering, but it's still not completely complete. since then, a few people have asked about it, so I've thought about releasing it just so people can play around with it, experiment, offer patches, and whatnot. here's the module as it exists today: http://www.modperlcookbook.org/~gyoung/modules/experimental/Apache-AuthDigest-0.01.tar.gz if a few people speak up and say they'd like it on CPAN I'll push it over... --Geoff
Re: [RFC] Apache::AuthDigest
Heyas, GYa few months ago I posted an RFC for a Digest authentication module... GYif a few people speak up and say they'd like it on CPAN I'll push it GYover... In the parlance of the Apache developer, list, +1 from me. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
form problems on 2.0.40 enctype=multipart/form-data fixes it
I have three machines, only one of which has the problem: These do not have the problem: 2.4.18-3smp/Apache 1.3.24/perl 5.6.1/mod_perl 1.26 2.4.7-10smp/Apache 1.3.24/perl 5.6.0/mod_perl 1.26 This one does: 2.4.18-5smp/Apache 2.0.40/perl 5.6.1/mod_perl 1.99_05 All the code is the same. I have a form that has ~40 fields, one of which takes fields up to a couple hundred characters (textarea). I get unpredictable results with the 2.0 machine in terms of mod_perl making breaks between different fields based on the form data if it has special characters (/' or some combination therein). The workaround to this is to use enctype=multipart/form-data on the form itself even though there is no file upload. I am just posting this to the board so that if someone sees the same thing, he/she will know the workaround and maybe somebody will try to duplicate it (although I had trouble duplicating it or differentiating it myself). adam
caching dynamic content in the reverse proxy
Hi following a recipe in modperl doc I have setup a front end plain apache "reverse proxy" + a back end modperl enabled. the front end has proxy cache enabled. any static content that is served by a default-handler from the backend server is well cached by the front one. but any content sent by a modperl handler is not cached although I set headers Last-Modified and Expires tocompatibles dates (with Apache::Util::ht_time) and Cache-content to public from the modperl handler with $r-header_out.. Also I wondered is the formatting of dates by ht_time (mer., 12 sept. 2002 12:20:01 GMT) by default is the "RFC one" ie the abbreviation point after day and month needed or not ? in any case i have tried both form without success for caching. Has any one succeeeded is caching dynamic content in this configuration thanks pascal winxp perl561/modperl126/apache1326
RE: User process ownership
You could do the chmod thing...but keep in mind, that it won't work unless you have perl compiled with suid script support (i think) and also your kernel has to support setuid scripts (which by default it probably doesn't because of race conditions causing major unsecurity...) On Fri, 2002-09-06 at 00:20, Mark Coffman wrote: Or if you really dont care about security maybe you could chmod 4755 the script, owned by root, to run as root. Just make sure that you clean all of the data you receive from the form. I kinda like the daemon idea that simran had. -Original Message- From: simran [mailto:[EMAIL PROTECTED]] Alternatively, you can write a daemon that runs as root that you can connect to that can do this...
[mp2.0] wrong crypt behavior
Hello, I use own PerlAuthenHandler module to verify users' login and password from database. For comparsion of password user entered and password stored in database is crypt function used. Here is the code: my $real_pass = $d-[0][0]; # crypted password from database my $salt = substr $real_pass,0,2; # salt my $test_pass = crypt $sent_pw,$salt; # in $sent_pw is the password user entered if ($real_pass eq $test_pass) { $r-subprocess_env(REMOTE_USER = $user); return OK; } else { $r-note_basic_auth_failure; return AUTH_REQUIRED; } Problem: Sometimes, although user entered correct password, is authentication rejected. I tried logging values of $real_pass and $test_pass and they differed. When I add line $r-log_reason(User $user tested (.$real_pass./.$test_pass.)...,); just before 'if' statement behavior is most of time correct. Can anybody help me? Thanks. Kacer