Re: [OT] About XML and Petal (was Re: templating system opinions (axkit?))
Le lundi, 28 juil 2003, à 21:27 Europe/Paris, Jean-Michel Hiver a écrit : Also, with TT you have to use the filter 'html' to XML encode your variables. Petal does it by default, and you need to use the TALES 'structure' keyword to NOT encode. You don't *have* to use the 'html' filter in TT. I wrote a subclass of Template which does this automatically for me, and as with Petal I can also not encode by using a specific method. -- Eric Cholet
Re: Few Important Questions
Mustafa Tan wrote: Hi Everybody, mod_perl is a great software. Thanks for everybody who spent time on it and make it available. When you send a reply to this, can you also describe how we can help, as an individiual, to support mod_perl and people behind it financially. Mustafa, one way to provide financial support is a donation: http://www.apache.org/foundation/contributing.html There's a paypal button on that page, and an address for sending checks. The ASF is a non profit org which makes donations tax deductible. mod_perl relies on the ASF infrastructure for its CVS server, mailing lists and web sites. Donations help fund these infrastructure expenses. Thanks! -- Eric Cholet
Re: How practical is that Practical mod_perl?
Stas Bekman wrote: [...] BTW, Eric is working on creating a new site for http://modperlbook.org/ which will include the source code, errata and other useful information. We will let you know when this work has been completed. I've just put it online. Enjoy, -- Eric Cholet
Re: evil scripts kill the server...
--On Wednesday, October 16, 2002 19:48:33 +0100 Ged Haywood [EMAIL PROTECTED] wrote: Hi there, On Wed, 16 Oct 2002, Joerg Plate wrote: Is it true that you can kill the whole server, not just the script if you do something wrong with mod_perl? Yes, I'm afraid it is. How? For example by swallowing all the memory, by consuming all the CPU, and of course by making root access available to the world through careless programming practice... Need I continue? Yes, please explain how careless programming practice can make root access available to the world. Apache by default runs under the unpriviliged user 'nobody', seems to me that giving root access to the world would require running Apache as root, not something which can be achieved only by careless programming. Am I missing something? -- Eric Cholet
Re: top for apache? [OT]
--On Sunday, September 22, 2002 09:54:02 -0400 Perrin Harkins [EMAIL PROTECTED] wrote: Nigel Hamilton wrote: It would be great to have a similar tool for mod_perl/apache. The closest thing available is a combination of mod_status and Apache::Status. If you haven't tried these yet, give them a shot. They provide a good deal of information. You might also want to check out Apache::VMonitor. From the module's description: This module emulates the reporting functionalities of top(1), extended for mod_perl processes, mount(1), and df(1) utilities. It has a visual alerting capabilities and configurable automatic refresh mode. All the sections can be shown/hidden dynamically through the web interface. -- Eric Cholet
Re: [OT] Which is the fastest XML/XSL engine?
--On vendredi 30 août 2002 09:40 +0100 [EMAIL PROTECTED] wrote: Hi, This is rather off topic, but since I will be running this under mod_perl: What is the fastest technology available for transforming XML using XSL under perl/mod_perl on apache? The only perl api I'm aware of is XML::XSLT which is not particularly fast. I'd like to do transforms in realtime for a high traffic site. Try XML::LibXSLT, in conjunction with XML::LibXML, these modules use the Gnome project's LibXML and LibXSLT which are quite fast. -- Eric Cholet
Re: Three tier computing: suggestion needed for DBI connection.
--On Thursday, August 15, 2002 12:32:16 +0200 Fabiàn R. Breschi [EMAIL PROTECTED] wrote: After digging more docs, finally found for PG DBI: DBI:Pg:dbname=mydb;host=Ultra1;port=5432 question 2 still there, thanks. All you need is the pgsql/lib and pgsql/include directories so that you can install DBD::Pg. Fabian. Fabián R. Breschi wrote: Hello all, At the moment I'm running Apache 1.3.12+mod_perl 1.27 with PG 7.2.1 via DBI-DBD on a SS5 Solaris 2.6 machine. I'd like to separate the database engine from the Apache environment so, running Apache+mod_perl+DBI+DBD on the front end and PostgreSQL at the backend (hope I'm right with this particular interpretation of 3tier and split of modules...) I have glanced around for DBI connect scenarios but could not find any useful example. My questions are: - How do I setup my connection string from $dbh=DBI-connect('DBI:Pg:dbname=mydb','login','password') to include in my 'dbname' the host name i.e. 'dbname=mydb@Ultra1' being Ultra1 a fully qualified alias into my hosts table, - Providing the above is possible, I imagine that leaving PG installed at the front end it could only be useful for 'psql -h Ultra1 mydb' but not necessarily used for DBI? Any suggestions are much appreciated. Fabian. -- Eric Cholet
Re: [Newbie Q] Cleanest way to implement one logon per user?
--On Thursday, August 01, 2002 15:08:40 -0400 Baljit Sethi [EMAIL PROTECTED] wrote: Hello. I am hoping someone can point me in the right direction. What I want to do is limit client logons to one logon per username ie while a client has a session open, he/she cannot logon to the website from another terminal. Platform: Apache 1.3.x with mod_perl DBI I have looked high and low, gone through Apache book after book with no measurable success (mod_usertrack mod_session are the only modules briefly mentioned). If someone could just point me in the right direction, I will gladly do all the required research. Someone recently suggested to me the following solution, based on slightly modified sessions. It involves sending a cookie that contains a new ID with each response. The server stores that ID keyed on the user's login name. The next request from the client is expected to return that cookie. If the ID doesn't match, redirect the user to the login page. If one client is using the site, he will login once and thereafter can use the site normally. If a second client comes in, after his initial login he will get a cookie with a new ID. This will make the first client's ID invalid. If both clients continue to issue requests they will keep on invalidating each other's ID thus forcing repeated logins. In a case where the contract explicitely disallows concurrent access with a given login name, the rightful client will probably complain and be a bit more weary of giving away his password to his friends or coworkers. An advantage to this system is that it doesn't require logout or timing out the session. Disclaimer: I have not implemented this system, and it's possibly that it has flaws that surely this list readers will be quick to point out, and I'll be grateful for that. -- Eric Cholet
Re: duplicate output with Registry.pm
--On Tuesday, July 16, 2002 06:44:10 -0400 Eric Frazier [EMAIL PROTECTED] wrote: Hi, It happens with the printenv script also. Again, I did this to myself before, but I can't remember how I fixed it. It was something very simple. Thanks, Seems like Location /perl will happily match urls such as /perlrun. Maybe you want to add trailing slashes to your Location and Alias directives. Eric My http.conf perl stuff = # mod_perl config PerlRequire /usr/local/apache/conf/Start.pl PerlFreshRestart On PerlInitHandler Apache::StatINC PerlSetVar StatINC_UndefOnReload On Alias /perl /usr/local/apache/perl PerlWarn On PerlModule Apache::Registry Location /perl PerlHandler Apache::Registry::handler SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader On Options +ExecCGI /Location Alias /perlrun /usr/local/apache/PerlRun Location /perlrun SetHandler perl-script PerlHandler Apache::PerlRun PerlSendHeader On Options +ExecCGI /Location http://www.kwinternet.com/eric (250) 655 - 9513 (PST Time Zone) Inquiry is fatal to certainty. -- Will Durant -- Eric Cholet
Re: [ANNOUNCE] Cache::Cache 1.0
--On dimanche 7 avril 2002 12:50 -0400 DeWitt Clinton [EMAIL PROTECTED] wrote: Hi, The following is an announcement of Cache::Cache 1.0. Please read the summary below for more details. I want to ask a special favor of the modperl community (who tend to get a lot of mileage out of this code) -- I'm concerned with the use of Digest::MD5, particularly version 2.16, which is used by the code to generate unique filenames in the file-based cache. I've been seeing some pretty ugly bugs with the the MD5 code, and this has been confirmed on a few mailing lists and CPAN bug reports. Please let me know if you notice any weird behavior with your system after upgrading to version 1.0. (All unit test pass consistently, but under certain conditions, such as when XML::DOM is loaded, I think that Digest::MD5 may always return the same hash, no matter what the key.) I'm seeing this problem when using Apache::SOAP, using Cache::Cache 0.99 or 1.0. Downgrading to Digest::MD5 2.12 indeed solves it. -- Eric Cholet
Re: Be carefull with apache 1.3.24
--On vendredi 29 mars 2002 13:26 -0500 John Siracusa [EMAIL PROTECTED] wrote: Anyway, now that I have patched, working versions, what's the status on apache.org fixing this bug in the real distribution? The Set-Cookie issue has been fixed in apache CVS, but the chunked response issue hasn't yet. Forward any ideas/patches to the [EMAIL PROTECTED] or to mod_proxy's maintainer, minfrin at sharp dot fm. -- Eric Cholet
Re: Be carefull with apache 1.3.24
--On lundi 1 avril 2002 17:12 +0100 Pedro Melo Cunha [EMAIL PROTECTED] wrote: It seems to be fixed in CVS Haven't tried it yet... As far as I can tell the chunked response bug hasn't been fixed yet. Best regards, On Fri, Mar 29, 2002 at 01:26:43PM -0500, John Siracusa wrote: On 3/29/02 1:11 PM, John Siracusa wrote: On 3/23/02 8:01 PM, Pedro Melo Cunha wrote: Looking at the change log, they mention a bug that multiple set-cookie's will fail (only the last one will be sent to the client, the proxy will eat the others). And it was true... The problem is that 1.3.24 final also has that bug: only the last set-cookie will reach your browser. This was a show-stopper for my application. So I sat down, read the proxy code, and made a patch to solve the bug. Applied the attached patch to 1.3.24, but it complained: --- % patch -i ../mod_proxy_patch.diff src/modules/proxy/proxy_http.c patching file src/modules/proxy/proxy_http.c Reversed (or previously applied) patch detected! Assume -R? [n] y --- I'm not sure what that means Heh, n e v e r m i n d... :) Anyway, now that I have patched, working versions, what's the status on apache.org fixing this bug in the real distribution? -John -- Pedro Melo Cunha - [EMAIL PROTECTED] Novis Telecom, S.A. - Dir. Rede - ISP http://www.novis.pt/ Edifício Novis - Estrada da Outurela, 118 - 2795-606 Carnaxide tel: +351 21 0104340 - fax: +351 21 0104301 -- Eric Cholet Logilune
Re: [slightly OT] Re: Be carefull with apache 1.3.24
--On lundi 1 avril 2002 16:44 -0500 Larry Leszczynski [EMAIL PROTECTED] wrote: On Mon, 1 Apr 2002, Eric Cholet wrote: The Set-Cookie issue has been fixed in apache CVS, but the chunked response issue hasn't yet. Forward any ideas/patches to the [EMAIL PROTECTED] or to mod_proxy's maintainer, minfrin at sharp dot fm. I have not yet been able to get 1.3.23 successfully patched to fix the Set-Cookie issue, and I can't use 1.3.24 because of the chunking problem. (Plus, the 1.3.23 problem of the proxy hanging on to back-end connections until it's done talking with the client pretty much defeats the purpose of using it in accelerator mode.) Does anyone know the most recent Apache version where the Set-Cookie and chunked problems were *not* an issue for mod_proxy? I have an old 1.3.14 instance that seems to work, but I'd rather not go back that far... I know the chunking bug wasn't in 1.3.22, but I do not know about the Set-Cookie status in that release because I didn't notice it until much later (customer setting multiple cookies complained). The chunking bug is of course much more visible since it breaks Netscape browsers completely. -- Eric Cholet Logilune
Re: cvs commit: modperl/t/net/perl util.pl
--On Sunday, March 24, 2002 21:57:54 + [EMAIL PROTECTED] wrote: dougm 02/03/24 13:57:53 Modified:.Changes STATUS src/modules/perl Util.xs t/net/perl util.pl Log: Submitted by: Geoff Young [EMAIL PROTECTED] Reviewed by:dougm properly escape highbit chars in Apache::Utils::escape_html This is uncool for those of us using a non-ASCII encoding and sending out lots of characters with the 8th bit set, e.g. in a French page many accented characters will be replaced by 6-byte sequences. If I'm sending out Content-type: text/html; charset=ISO-8859-1, and calling escape_html to escape '', '' and the like, I'm going to be serving quite a lot more bytes than before this patch. However escape_html () has no clue as to what the character set is, and whether it has been correctly specified in the Content-Type. It has also be mentionned here that escape_html is only valid for single-byte encodings. So this patch does the right thing to escape the odd 8 bit char in a mostly ASCII output, but users of other charsets should be warned not to use it. I use HTML::Entities::encode($_[0], '') myself. Therefore I propose a doc patch to clear this up: Index: Util.pm === RCS file: /home/cvs/modperl/Util/Util.pm,v retrieving revision 1.8 diff -u -r1.8 Util.pm --- Util.pm 4 Mar 2000 20:55:47 - 1.8 +++ Util.pm 25 Mar 2002 18:19:37 - @@ -68,6 +68,13 @@ my $esc = Apache::Util::escape_html($html); +This function is unaware of its argument's character set and encoding. +It assumes a single-byte encoding and escapes all characters with the +8th bit set. Do not use it with multi-byte encodings such as utf8. +When using a single byte non-ASCII encoding such as ISO-8859-1, +consider specifying the character set in the Content-Type header, +and using HTML::Entities to avoid unnecessary escaping. + =item escape_uri This function replaces all unsafe characters in the $string with their -- Eric Cholet
Re: cvs commit: modperl/t/net/perl util.pl
--On Monday, March 25, 2002 10:29:11 -0800 Doug MacEachern [EMAIL PROTECTED] wrote: i had a bad feeling about this. we should not be implementing escape_html to begin with, the functionality should all be in apache. i'm going to back out the patch. anybody care to make a doc patch to explain the problems with escape_html before the patch went in? thanks. I believe the patch is useful though, in cases where the charset is not explicitely specified and there's an odd character with the 8th bit set it will now do the right thing. I guess a lot of US coders would fall in that situation... I suppose it's faster than HTML::Entities (I haven't benchmarked it though). So I suspect the patch will fix more situations than it breaks: if using a single-byte non-ASCII encoding, it doesn't actually break anything, just adds bloat. If using a multi-byte encoding escape_html was broken/inapplicable already. -- Eric Cholet
Re: mod_perl, mod_gzip, incredible suckage
--On vendredi 15 février 2002 17:19 +0300 Igor Sysoev [EMAIL PROTECTED] wrote: You can try ftp://ftp.lexa.ru/pub/apache-rus/contrib/mod_deflate-1.0.11.tar.gz It compresses content on the fly without any temporary files as mod_gzip does. It has workarounds with buggy browsers. mod_gzip has not. Drawbacks: It patches Apache and can not be loaded as DSO. It compresses static files every time. mod_gzip can use cached compressed file. It has Russian documentation only but you can ask me if you have any problems. Yeah, can you translate that little paragraph about FreeBSD? -- Eric Cholet
Re: What phase am I in?
--On jeudi 20 décembre 2001 16:10 -0600 Dave Rolsky [EMAIL PROTECTED] wrote: On Thu, 20 Dec 2001, Perrin Harkins wrote: I've looked through the mod_perl docs and guide and am unable to find something that I can use in a handler to figure out what the current phase is. This seems like such an obvious thing that I can't believe it doesn't exist. Therefore I will conclude that I'm completely blind. Anyone care to open my eyes? http://mathforum.org/epigone/modperl/liphortwa/Pine.LNX.4.10.99092112175 10.5 [EMAIL PROTECTED] It's called current_callback(). Grr, its not documented when I do 'perldoc Apache'. It is now. -- Eric Cholet
cvs commit: modperl/Apache Apache.pm
cholet 01/12/28 02:25:48 Modified:Apache Apache.pm Log: more docco Revision ChangesPath 1.66 +23 -7 modperl/Apache/Apache.pm Index: Apache.pm === RCS file: /home/cvs/modperl/Apache/Apache.pm,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- Apache.pm 2001/12/27 15:44:33 1.65 +++ Apache.pm 2001/12/28 10:25:48 1.66 @@ -650,15 +650,29 @@ authentication realm, from C$r-Egtauth_name, to determine which set of credentials to authenticate. -=item $r-document_root +=item $r-document_root ( [$docroot] ) -Returns a reference to the current value of the per server -configuration directive BDocumentRoot. To quote the Apache server -documentation, Unless matched by a directive like Alias, the server -appends the path from the requested URL to the document root to make -the path to the document. This same value is passed to CGI +When called with no argument, returns a reference to the current value +of the per server configuration directive BDocumentRoot. To quote the +Apache server documentation, Unless matched by a directive like Alias, +the server appends the path from the requested URL to the document root +to make the path to the document. This same value is passed to CGI scripts in the CDOCUMENT_ROOT environment variable. +You can also set this value by providing an argument to it. The following +example dynamically sets the document root based on the request's +Host: header: + + sub trans_handler + { +my $r = shift; +my ($user) = ($r-header_in('Host') =~ /^[^\.]+/); +$r-document_root(/home/$user/www); +return DECLINED; + } + + PerlTransHandler trans_handler + =item $r-allow_options The C$r-Egtallow_options method can be used for @@ -960,7 +974,9 @@ =item $r-no_cache( $boolean ) This is a flag that indicates that the data being returned is volatile -and the client should be told not to cache it. +and the client should be told not to cache it. C$r-Egtno_cache(1) +adds the headers Pragma: no-cache and Cache-control: no-cache to +the reponse, therefore it must be called before C$r-Egtsend_http_header. =item $r-print( @list )
cvs commit: modperl/Apache Apache.pm
cholet 01/12/27 07:44:33 Modified:Apache Apache.pm Log: document current_callback() Revision ChangesPath 1.65 +9 -0 modperl/Apache/Apache.pm Index: Apache.pm === RCS file: /home/cvs/modperl/Apache/Apache.pm,v retrieving revision 1.64 retrieving revision 1.65 diff -u -r1.64 -r1.65 --- Apache.pm 2001/05/01 17:28:34 1.64 +++ Apache.pm 2001/12/27 15:44:33 1.65 @@ -776,6 +776,15 @@ $r-push_handlers( PerlHandler = \footer); +=item $r-current_callback + +Returns the name of the handler currently being run. This method is most +useful to PerlDispatchHandlers who wish to only take action for certain phases. + + if($r-current_callback eq PerlLogHandler) { + $r-warn(Logging request); + } + =back =head1 SETTING UP THE RESPONSE
Re: Any good WebMail programs?
I can use a primer on researching WebMail programs with the following http://www.astray.com/acmemail/ -- Eric Cholet
RE: Auth Handlers
--On mardi 11 décembre 2001 23:36 +0100 J. Zobel [EMAIL PROTECTED] wrote: On Tue, 2001-12-11 at 21:00, Stathy Touloumis wrote: Actually, I DON'T want the browser to prompt for a username/pass. I saw the examples in the eagle book and they all seem to use Authz, with Auth handlers using the example you showed. Perhaps I need to modify the headers so that the prompt does not occur? I have the exact same problem. I want my AuthenHandler to decide if the user is prompted for a password. Unfortunately the book tells me: By the time the handler is called, Apache will have done most of the work in negotiating the HTTP Basic authentication protocol. It will have alerted the browser that authentication is required to access the page, and the browser will have prompted the user to enter his name and password. Has anybody got an idea how to let a handler decide, if autthen. is required? You could use a PerlAccessHandler, if you figure authentication isn't required you run $r-set_handlers(PerlAuthenHandler = [\OK]); -- Eric Cholet
Re: Defeating mod_perl Persistence
--On mardi 11 décembre 2001 12:25 + Jonathan M. Hollin [EMAIL PROTECTED] wrote: Hey Gang, When using Mail::Sender only the first email is sent on my mod_perl server. When I investigated, I realised that the socket to the SMTP server was staying open after the completion of that first email (presumably mod_perl is responsible for this persistence). Is there any way to defeat the persistence on the socket while running my script under mod_perl, or do such scripts always need to be mod_cgi? FYI, the script works fine under mod_cgi. maybe you should just call Close() on the Mail::Sender object, from the docs: Close $sender-Close; Close and send the mail. This method should be called automatically when destructing the object, but you should call it yourself just to be sure it gets called. And you should do it as soon as possible to close the connection and free the socket. The mail is being sent to server, but is not processed by the server till the sender object is closed! -- Eric Cholet
Re: [modperl site design challenge] please vote]]
--On mardi 4 décembre 2001 08:17 -0800 Emad Fanous [EMAIL PROTECTED] wrote: Sorry, someone (you?) has already voted from IP address my ip listed here So much for allowing my co-workers to vote even though we have unique email addresses. :-( Emad Sorry about that, this constraint has been removed, please try again. -- Eric Cholet
Re: Using Apache::Reload in development environment?
--On 30/07/01 06:43 -0400 Philip Mak wrote: In perldoc Apache::Reload, the DESCRIPTION has the following sections: - StatINC Replacement - Register Modules Implicitly - Register Modules Explicitly - Special Touch File I just re-read it again and realized that StatINC Replacement is what I wanted... although it wasn't obvious from just reading the header since I don't know what StatINC is. Re-reading the first paragraph of DESCRIPTION, I see that it implies that StatINC always checks the modification time of the file. I was also somewhat confused as to what PerlSetVar ReloadAll does since that perldoc page did not have an explicit definition, only examples of it being used. PerlSetVar ReloadAll will reload all modules. That might take some time, so you might want to reload only your own modules, in which case you set it to Off, and add a directive to reload only your tree, such as PerlSetVar ReloadModules Foo::* Bar::* -- Eric Cholet 145C FF7F 7920 04B0 7BA3 48D8 5591 E2C0 6664 C078
Re: cvs commit: modperl-site/guide download.html
modperl-site/guide/download.html Index: download.html === RCS file: /home/cvs/modperl-site/guide/download.html,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- download.html 2001/04/27 16:57:12 1.16 +++ download.html 2001/07/17 15:16:38 1.17 @@ -172,9 +172,9 @@ P Every Apache project rolls a new tar.gz snapshot of the latest CVS version every 6 hours. You can grab the latest mod_perl CVS snapshot from A -HREF=http://perl.apache.org/from-cvs/modperl/;http://perl.apache.org /from-cvs/modperl//A, +HREF=http:/cvs.apache.org/snapshots/modperl/http:/cvs.apache.org/sn apshots/modperl//A, all the mod_perl related projects are available from A -HREF=http://perl.apache.org/from-cvs.;http://perl.apache.org/from-cv s./A +HREF=http:/cvs.apache.org/snapshots.http:/cvs.apache.org/snapshots. /A P -- Eric Cholet B995 E519 1594 10D0 4271 1EA5 8DF3 8004
Re: BOF?
--On 16/07/01 16:48 +0200 Robin Berjon wrote: I arrive on Sunday evening too, is there a good way to recognize a bunch of modperlians ? I've only ever seen two people on this list so if they aren't there I won't recognize anyone :) don't worry, both these people will be there ;) -- Eric Cholet B995 E519 1594 10D0 4271 1EA5 8DF3 8004
cvs commit: modperl/t/net/perl/io redir1.pl redir2.pl
cholet 01/07/16 10:11:04 Modified:t/internal redirect.t Added: t/net/perl/io redir1.pl redir2.pl Log: add internal_redirect test Revision ChangesPath 1.5 +12 -3 modperl/t/internal/redirect.t Index: redirect.t === RCS file: /home/cvs/modperl/t/internal/redirect.t,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- redirect.t1999/02/23 19:21:38 1.4 +++ redirect.t2001/07/16 17:11:04 1.5 @@ -22,7 +22,7 @@ my($request,$response); -my $tests = 3; +my $tests = 4; $CGI::VERSION ||= 0; @@ -64,6 +64,15 @@ print content=`, $response-content, '\n; +#test internal redirect +$request = HTTP::Request-new(GET = http://$net::httpserver$net::perldir/io/redir1.pl;); +$response = $ua-request($request, undef, undef); +unless ($response-content eq 'OK') { +print not ; +} +print ok 4\n; +print content=`, $response-content, '\n; + if ($qredirect) { $request = HTTP::Request-new(GET = $qredirect); @@ -73,7 +82,7 @@ print not ; } -print ok 4\n; +print ok 5\n; print content=`, $response-content, '\n; @@ -85,7 +94,7 @@ print not ; } -print ok 5\n; +print ok 6\n; print content=`, $response-content, '\n; 1.1 modperl/t/net/perl/io/redir1.pl Index: redir1.pl === use strict; my $r = shift; $r-internal_redirect('/perl/io/redir2.pl'); 1.1 modperl/t/net/perl/io/redir2.pl Index: redir2.pl === use strict; my $r = shift; $r-send_http_header('text/plain'); print OK;
Re: perl 5.6 + mod_perl in production environment
--On 11/07/01 07:57 -0700 Eric Kolve wrote: I was wondering if anyone is currently using perl 5.6 + mod_perl in a prod environment. What kinds of problems, if any are people seeing with this? I've been using 5.6.1 in production for a while, no problems. -- Eric Cholet B995 E519 1594 10D0 4271 1EA5 8DF3 8004
mod_perl/IPC feedback needed
Folks, I'm looking for some feedback regarding what IPC techniques are being used in conjunction with mod_perl. I know about IPC::Shareable, IPC::ShareLite. What other IPC modules/techniques are you using? Or not using because they don't work/aren't stable/whatever. I'm interested in any experience with IPC, good or bad. Please reply privately. If there is interest I'll post a digest of the replies. Thanks, -- Eric Cholet
cvs commit: modperl apache-modlist.html
cholet 01/02/13 07:52:56 Modified:.apache-modlist.html Log: remove unreleased module Revision ChangesPath 1.80 +1 -2 modperl/apache-modlist.html Index: apache-modlist.html === RCS file: /home/cvs/modperl/apache-modlist.html,v retrieving revision 1.79 retrieving revision 1.80 diff -u -r1.79 -r1.80 --- apache-modlist.html 2000/10/13 16:44:46 1.79 +++ apache-modlist.html 2001/02/13 15:52:55 1.80 @@ -6,7 +6,7 @@ h1The Apache/Perl Module List/h1 Maintained by a href="mailto:[EMAIL PROTECTED]"Doug MacEachern/a, -bri $Revision: 1.79 $ $Date: 2000/10/13 16:44:46 $/i +bri $Revision: 1.80 $ $Date: 2001/02/13 15:52:55 $/i h3Contents/h3 a href="#intro"Introduction/abr @@ -66,7 +66,6 @@ Apache:: * PerlHandler's -AdBanner cdpfAd banner server CHOLET AddrMungebdpfMunge email addresses in webpages MJD AutoIndexRdcfLists directory content GOZER Archive bdpfMake linked contents pages of .tar(.gz) JPETERSON
cvs commit: modperl-site/dist apache-modlist.html
cholet 01/02/13 07:54:05 Modified:dist apache-modlist.html Log: remove unreleased module Revision ChangesPath 1.19 +1 -2 modperl-site/dist/apache-modlist.html Index: apache-modlist.html === RCS file: /home/cvs/modperl-site/dist/apache-modlist.html,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- apache-modlist.html 2000/10/13 16:49:07 1.18 +++ apache-modlist.html 2001/02/13 15:54:05 1.19 @@ -6,7 +6,7 @@ h1The Apache/Perl Module List/h1 Maintained by a href="mailto:[EMAIL PROTECTED]"Doug MacEachern/a, -bri $Revision: 1.18 $ $Date: 2000/10/13 16:49:07 $/i +bri $Revision: 1.19 $ $Date: 2001/02/13 15:54:05 $/i h3Contents/h3 a href="#intro"Introduction/abr @@ -66,7 +66,6 @@ Apache:: * PerlHandler's -AdBanner cdpfAd banner server CHOLET AddrMungebdpfMunge email addresses in webpages MJD AutoIndexRdcfLists directory content GOZER Archive bdpfMake linked contents pages of .tar(.gz) JPETERSON
Re: Unset PerlAuthenHandler (I wish)
Essentially I want to do this. Unset PerlAuthenHandler Try: LocationMatch /websites/foo.net/htdocs/passwd_forgoten/ PerlInitHandler "sub {$_[0]-set_handlers(PerlAuthenHandler=undef);}" /LocationMatch I think this should be: ... set_handlers(PerlAuthenHandler = [\OK]); -- Eric
Re: ANNOUNCEMENT: NEW VERSION: HTML::Template 2.1
ANNOUNCEMENT: NEW VERSION: HTML::Template 2.1 HTML::Template - a Perl module to use HTML Templates Does it support ELSIF yet? -- Eric
Re: Question
GWH HI Stas, GWH On Mon, 11 Sep 2000, Stas Bekman wrote: Will you also ask why Stas is learning French? GWH Chercher la femme? Most likely because the people in Paris demand you speak to them in perfect French. High school level French is not accepted ;-| well then we're a long shot away, and so are many French natives :) Nah, we won't be that demanding, lest we scare him away from the, erm, "most beautiful city in the world". -- Eric
Re: PerlAuthenHandler -- doesn't get there...?
i canna get the PerlAuthenHandler to do ANYTHING. first line of code after $r = shift is $r-warn() but nothing shows up in the log. aaugh! i copied the sample code from 'illustrated security scenarios' at http://perl.apache.org/guide/security.html nearly verbatim, (cut paste + munge) changed '(*PASSED*)' to a simple test (moot, at this point) and inserted a few $r-warn("") for tracing and debugging purposes. access_handler() works fine. all its $r-warn output shows up in the logfile as it should. BUT i never see any incursion into the authen_handler() AT ALL! maybe you need "Order deny, allow" to trigger authentication [my main site is serensoft.com; the virtual site is dontUthink.com and the url i'm trying to test is dontUthink.com/auth ... it lets me in, every time, without asking for any userid:password.] httpd.conf: PerlModule Serensoft::Auth Location /auth PerlAccessHandler Serensoft::Auth::access_handler PerlSetVar Intranet "this = that" PerlAuthenHandler Serensoft::Auth::authen_handler AuthName "dontUthink subscriber" AuthType Basic Require valid-user /Location Serensoft/Auth.pm: Package Serensoft::Auth; use strict; use Apache::Constants qw(:common); [snip] sub authen_handler { my $r = shift; $r-warn('authen_handler'); # == NEVER gets here!!! # get user's authentication credentials my ($res, $sent_pw) = $r-get_basic_auth_pw; return $res if $res != OK; my $user = $r-connection-user; # authenticate through DBI my $reason = authen_dbi ($r, $user, $sent_pw); # $level? eh? if ($reason) { $r-note_basic_auth_failure; $r-log_reason ($reason, $r-uri); return AUTH_REQUIRED; } return OK; } i even tried adding $r-set_handlers(PerlAuthenHandler = [\authen_handler]); right at the end of access_handler() (before returning OK) but alas, to no avail. what obvious dial have i forgotten to frob? -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Their is five errers in this sentance.
cvs snapshots
We no longer have cvs snapshots in http://dev.apache.org/from-cvs/ There's only httpd in there. (we link to this from http://perl.apache.org/distributions.html) -- Eric Cholet
Re: my transhandler runs only once in each child ?!?
Dear All I've a bug somewhere that I cannot appear to spot.. I have writen parts of a transhandler to handle session's. It works in once in each child and then does not appear to be executed again. I've looked through The Guide and could not see anything there, nor in the 'Apache modules in Perl and C'. I must be missing somehing (a clue for a start ;-). The obvious answer is that a variable is not being redefined / initialised. Any ideas appreciated. Greg Cope ### some clues below (I hope) I have these lines in my startup.pl: use tinasm::Session(); $tinasm::Session::DEBUG = 1; $tinasm::Session::DIR_MATCH = 'test'; $tinasm::Session::REDIRECT = 1; $tinasm::Session::USE_ENV = 1; # end of startup.pl, snippet # part of the module below # code snippet # package tinasm::Session; use strict; use Apache; use Apache::Constants qw(DECLINED REDIRECT OK); use Digest::MD5 qw(md5_hex); use constant SESSION_ID_LENGTH = 8; use vars qw($DIR_MATCH $COOKIES_ONLY $ARGS_ONLY $DEBUG $REDIRECT $URI_FIRST $USE_ENV); Apache-push_handlers("PerlTransHandler", \transhandler); this will trigger the handler for the first request. Nothing will trigger it for subsequent requests. If you want it to run for every request, why not just drop the push_handlers call and add PerlTransHandler tinasm::Session to httpd.conf. sub transhandler { my $r = shift; unless ($r-uri =~ m!$DIR_MATCH!o) { print STDERR "SESSION-MANAGER-$$-URI not matched\n" if $DEBUG; return DECLINED; } print STDERR "SESSION-MANAGER-$$-URI match\n" if $DEBUG; . handler goes on for another 200 lines so I've snipped it - if anyone wants to look at it drop me a line. -- Eric
Re: ignore header_only()?
Ken Fox wrote: I was using $request-sent_header and found out that it's not terribly useful if PerlSendHeader is off -- sent_header always returns 1. I changed mod_perl_sent_header so that it returns 0, 1 or 2: 0 - headers have not been sent (PerlSendHeader on) 1 - headers have not been sent (PerlSendHeader off) 2 - headers have already been sent Is this the right list for change proposals? Should I re-submit my patch? Yes it's the right list, and no, no need to resubmit. Personally I only commit bug fixes, and Doug looks at new features. He'll get around to it, he's just a bit busy at the moment. Thanks, -- Eric
Re: does anyone have a fix for this?
Hello all, I'm new to the list and I'm hoping that someone could help me and explain what I'm doing wrong or how to fix this I recently compiled mod_perl-1.24 and it can run modules that I program. However I get a segmentation fault (11) when I use a :: to describe where the module is. Example This works fine - Location /hello SetHandler perl-script PerlHandler hello /Location This causes the horrible [Wed Aug 2 22:34:30 2000] [notice] child pid 4433 exit signal Segmentation fault (11) Please read the SUPPORT file from the mod_perl distribution for information on how to supply a backtrace so we can investigate the segfault. Thanks, -- Eric
Re: Problem with proxys Auth...
This is a strange one for which I hope there's a simple answer solution. I've put a Front-side Proxy on a webserver (as it was struggling under the load from lots of hits over slow links - more RAM than CPU issue), and it's helped performance wonderfully! However, my IP-based restrictions now seem to no longer work! Before you ask, yes, I'm using mod_proxy_add_forward, with a "PerlPostReadRequestHandler My::ProxyRemoteAddr" routine at the other end to rewrite the IP back using $r-connection-remote_ip. So, yes, as far as my CGIs, my modules, and the logging is concerned, people are from their REAL IPs (rather than that of the FSP), but IP restrictions (using the standard mod_access) are not taking effect at all! Any ideas on why this is, and how to get around it? I've done some testing research, and AFAICS, it should work, as Post Read Requests happen before the Access phase... Which version of mod_perl are you using? I fixed this in 1.22_01. -- Eric
cvs commit: modperl/src/modules/perl Apache.xs
cholet 00/07/25 10:59:49 Modified:.Changes src/modules/perl Apache.xs Log: return code from stat() call was being ignored Revision ChangesPath 1.502 +3 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.501 retrieving revision 1.502 diff -u -r1.501 -r1.502 --- Changes 2000/07/24 13:22:50 1.501 +++ Changes 2000/07/25 17:59:45 1.502 @@ -10,6 +10,9 @@ =item 1.24_01-dev +flush r-finfo cache if r-filename fails +[Roger Espel Llima [EMAIL PROTECTED]] + fix per-dir merging of PerlSetupEnv [Eric Cholet [EMAIL PROTECTED]] INSTALL.raven update [Adam Qualset [EMAIL PROTECTED]] 1.99 +3 -1 modperl/src/modules/perl/Apache.xs Index: Apache.xs === RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v retrieving revision 1.98 retrieving revision 1.99 diff -u -r1.98 -r1.99 --- Apache.xs 2000/06/05 18:18:49 1.98 +++ Apache.xs 2000/07/25 17:59:48 1.99 @@ -1870,7 +1870,9 @@ get_set_PVp(r-filename,r-pool); #ifndef WIN32 if(items 1) - stat(r-filename, r-finfo); + if ((laststatval = stat(r-filename, r-finfo)) 0) { +r-finfo.st_mode = 0; + } #endif OUTPUT:
Re: PerlSetupEnv is evil
-Original Message- From: Roger Espel Llima [mailto:[EMAIL PROTECTED]] Sent: Friday, July 07, 2000 5:19 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: PerlSetupEnv is evil [snip] It also turns out that specifying "PerlSetupEnv Off" outside of any Directory apparently gets ignored. Is that a bug? I put another "PerlSetupEnv Off" in the Directory entry for the DocumentRoot, and now it's not doing these annoying subrequests anymore. it is a bug (prior report: http://marc.theaimsgroup.com/?l=apache-modperlm=95867712412668w=2) - PerlSetupEnv is not inheriting properly. I think this fell to low on the ToDo list since there is a (rather lengthy) workaround of sprinkling PerlSetupEnv Off everywhere you need/want it. I've just committed a change which fixes this. Please try it and let me know if it works for you. -- Eric
cvs commit: modperl/src/modules/perl mod_perl.h perl_config.c
cholet 00/07/24 06:33:03 Modified:src/modules/perl mod_perl.h perl_config.c Log: revert my latest change, my editor suddenly decided to untabify everything, burying the actual change Revision ChangesPath 1.100 +34 -34modperl/src/modules/perl/mod_perl.h Index: mod_perl.h === RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.h,v retrieving revision 1.99 retrieving revision 1.100 diff -u -r1.99 -r1.100 --- mod_perl.h2000/07/24 13:22:55 1.99 +++ mod_perl.h2000/07/24 13:33:00 1.100 @@ -64,7 +64,7 @@ #include malloc.h #include win32.h #include win32iop.h -#include fcntl.h // For O_BINARY +#include fcntl.h // For O_BINARY #include "EXTERN.h" #include "perl.h" #include iperlsys.h @@ -195,7 +195,7 @@ #endif #ifndef AvFILLp -#define AvFILLp(av) ((XPVAV*) SvANY(av))-xav_fill +#define AvFILLp(av) ((XPVAV*) SvANY(av))-xav_fill #endif #ifdef eval_pv @@ -300,7 +300,7 @@ #define av_copy_array(av) av_make(av_len(av)+1, AvARRAY(av)) #ifndef newRV_noinc -#define newRV_noinc(sv) ((Sv = newRV(sv)), --SvREFCNT(SvRV(Sv)), Sv) +#define newRV_noinc(sv) ((Sv = newRV(sv)), --SvREFCNT(SvRV(Sv)), Sv) #endif #ifndef SvTAINTED_on @@ -349,14 +349,14 @@ #define mp_debug mod_perl_debug_flags -extern U32 mp_debug; +extern U32 mp_debug; #ifdef PERL_TRACE -#define MP_TRACE(a) if (mp_debug) a -#define MP_TRACE_d(a) if (mp_debug 1) a /* directives */ -#define MP_TRACE_s(a) if (mp_debug 2) a /* perl sections */ -#define MP_TRACE_h(a) if (mp_debug 4) a /* handlers */ -#define MP_TRACE_g(a) if (mp_debug 8) a /* globals and allocation */ +#define MP_TRACE(a) if (mp_debug) a +#define MP_TRACE_d(a) if (mp_debug 1) a /* directives */ +#define MP_TRACE_s(a) if (mp_debug 2) a /* perl sections */ +#define MP_TRACE_h(a) if (mp_debug 4) a /* handlers */ +#define MP_TRACE_g(a) if (mp_debug 8) a /* globals and allocation */ #define MP_TRACE_c(a) if (mp_debug 16) a /* directive handlers */ #ifndef PERL_MARK_WHERE #define PERL_MARK_WHERE @@ -405,14 +405,14 @@ #define MPf_Off -1 #define MPf_None 0 -#define MPf_INCPUSH 0x0100 /* use lib split ":", $ENV{PERL5LIB} */ -#define MPf_SENDHDR 0x0200 /* is PerlSendHeader On? */ -#define MPf_SENTHDR 0x0400 /* has PerlSendHeader sent the headers? */ -#define MPf_ENV 0x0800 /* PerlSetupEnv */ -#define MPf_HASENV 0x1000 /* do we have any PerlSetEnv's? */ -#define MPf_DSTDERR 0x2000 /* redirect stderr to error_log */ -#define MPf_CLEANUP 0x4000 /* did we register our cleanup ? */ -#define MPf_RCLEANUP0x8000 /* for $r-register_cleanup */ +#define MPf_INCPUSH 0x0100 /* use lib split ":", $ENV{PERL5LIB} */ +#define MPf_SENDHDR 0x0200 /* is PerlSendHeader On? */ +#define MPf_SENTHDR 0x0400 /* has PerlSendHeader sent the headers? */ +#define MPf_ENV 0x0800 /* PerlSetupEnv */ +#define MPf_HASENV 0x1000 /* do we have any PerlSetEnv's? */ +#define MPf_DSTDERR 0x2000 /* redirect stderr to error_log */ +#define MPf_CLEANUP 0x4000 /* did we register our cleanup ? */ +#define MPf_RCLEANUP 0x8000 /* for $r-register_cleanup */ #define MP_FMERGE(new,add,base,f) \ if((add-flags f) || (base-flags f)) \ @@ -442,7 +442,7 @@ #define MP_ENV_off(d)(d-flags = ~MPf_ENV) #endif -#define MP_ENV(d) (d-SetupEnv != MPf_Off) +#define MP_ENV(d) (d-SetupEnv == MPf_On) #define MP_ENV_on(d)(d-SetupEnv = MPf_On) #define MP_ENV_off(d) (d-SetupEnv = MPf_Off) @@ -535,13 +535,13 @@ #define HAS_CONTEXT MODULE_MAGIC_AT_LEAST(MMN_136,2) #if HAS_CONTEXT -#define CAN_SELF_BOOT_SECTIONS (PERL_SECTIONS_SELF_BOOT) -#define SECTION_ALLOWED OR_ALL -#define USABLE_CONTEXT parms-context -#else -#define CAN_SELF_BOOT_SECTIONS ((parms-path==NULL)PERL_SECTIONS_SELF_BOOT) -#define SECTION_ALLOWED RSRC_CONF -#define USABLE_CONTEXT parms-server-lookup_defaults +#define CAN_SELF_BOOT_SECTIONS (PERL_SECTIONS_SELF_BOOT) +#define SECTION_ALLOWED OR_ALL +#define USABLE_CONTEXT parms-context +#else +#define CAN_SELF_BOOT_SECTIONS ((parms-path==NULL)PERL_SECTIONS_SELF_BOOT) +#define SECTION_ALLOWED RSRC_CONF +#define USABLE_CONTEXT parms-server-lookup_defaults #endif #define APACHE_SSL_12X (defined(APACHE_SSL) (MODULE_MAGIC_NUMBER MMN_130)) @@ -598,7 +598,7 @@ "access to %s failed for %s, reason: %s", \ file, \ get_remote_host(r-connection, \ -r-per_dir_config, REMOTE_NAME), \ +
Re: can't get unbuffered output to work
Steve van der Burg writes: Hi, unbuffered output in a handler just doesn't work for me: [ details of setup and handler snipped ] If I 'GET /unbuffered' in Netscape nothing is printed until I stop the server. Setting $|++ does not help. Something is still buffering. This is modperl 1.21 and Apache 1.3.12. Any clues? Netscape is waiting for an HTML visual break of some kind before showing any output - if you modify your test handler to spew "bHello!/bp" before sleeping, you should see it. No, sorry Steve, this doesn't help. I've also tried BR and text/plain. MSIE is no different. I've noticed that MSIE doesn't start displaying stuff until it has a certain amount, say a few hundred bytes. After that it displays just fine. -- Eric
Re: How to get VirtualHostUser abc/VirtualHost
I have a PerlTransHandler and I have a bunch of virtual hosts. Each virtual host looks like this VirtualHost abc.com User abc Group abcs /VirtualHost (How) can I access the User and Group definitions in the VirtualHost (which are intended for suexec)? Is this feature missing in mod_perl 1.24? The eagle book only knows on mod_perl 1.19. You can use $r-server-uid and $r-server-gid, these were added in 1.21_01. -- Eric
Re: Using handler for index
Location / SetHandler perl-script PerlHandler ModuleName /Location Well, seems like I tried that, and then it ALWAYS used that handler. I also have other handlers, and I _think_ the setup above overrode the others. I'll give it a try again now. OK, I just tried it, and it overrode everything else. :-( Try LocationMatch ^/$ -- Eric
Re: PerlAddVar bug
On Thu, 6 Jul 2000, Geoffrey Young wrote: Sorry to bring up PerlAddVar again, but this time I have a legitimate bug. It stems from what I reported last time about items in Apache::Table not being visible outside a Location directives: See the section on DIR_MERGE in the Eagle book. It just needs someone to write that code for PerlAddVar/PerlSetVar. But there is dir_merge code for those variables, this works for me: PerlSetVar MyVar foo Location /test/ PerlSetVar MyVar bar SetHandler "perl-script" PerlHandler Apache::Registry Options +ExecCGI /Location test/foo: my $r = shift; $r-send_http_header('text/plain'); print $r-dir_config('MyVar'); % GET http://localhost/test/foo bar I don't know about PerlAddVar, haven't tested Geoff's examples yet, but it should work as well since those vars all end up in perl_dir_config-vars -- Eric
Re: User pressed stop?
Every so often I get: Broken pipe: client stopped connection before rflush completed In my error log. Is that the "user pressed stop" condition? AxKit just sends raw files (unless in no_cache mode), i.e. it sets $r-filename() and then returns DECLINED. Do I need to handle this, or can I just ignore it? ap_rflush is called to write data to the client, but the write fails. It's a normal "user pressed stop" condition, ap_rflush issues the info message and sets c-aborted so that subsequent writes will not reach the network. You can ignore the message, it is printed because you have LogLevel = info. -- Eric
Re: $r-path_info question
Hi all, I am using $r-path_info in an Apache handler. The handler is set via a Location directive: Location /cgi-bin/detail.pl # Overcoming Legacy code :-) SetHandler perl-script PerlHandler eLogix::Images::Detail /Location And is called like "/cgi-bin/detail.pl/A1234567.jpg". My question is this: Since there is no physical filename which corresponds to the URL, what does path_info contain? In the eagle book on page 135, when path_info is first discussed, the example uses $r-lookup_uri($path_info) to get the filename, which in this example is a purely virtual tree. $r-path_info contains what's left of the URI after it's been mapped to a (virtual) file, in your case /A1234567.jpg I currently am using my $filename = (split /\//, $r-path_info)[1]; or you could have used (my $filename = $r-path_info) =~ s!^/!!; but it seems like such a hack. What is the "suggested" way to get the "A1234567.jpg" part of the above URL? Since you have no trailing slash in your Location directive, you get a leading / in path_info. What would be the filename if the request URI was /cgi-bin/detail.pl/foo/bar.jpg ? In that case path_info will be '/foo/bar.jpg'. Maybe what you really want is my $filename = (split /\//, $r-path_info)[-1]; whatever... it's completely up to the application to define the semantics of path_info. -- Drew Taylor -- Eric
Re: Segfault Apache1.3.12/mod_perl1.24/Solaris2.6
Hi all, Sorry, this is a bit long. [snip] [Fri Jun 16 17:20:21 2000] [notice] \ child pid 22310 exit signal Segmentation Fault (11) [snip] There is no core dump and the same thing happens with the -X switch. please see the instructions in SUPPORT on how to provide a backtrace. -- Eric
Re: jim's design
On Sun, Jun 18, 2000 at 03:02:25AM -0700, brian moseley wrote: .. is ready to go. i can go ahead and update index.html, and jim's also updated several of the pages linked from there. but some of the others haven't been updated - should i do them all, or should i just do index.html and see what people think, or..? speaking of which - is there an automated process that updates /www/perl.apache.org from the modperl-site cvs module? or do i need to copy things by hand? cd /da1/www/perl.apache.org cvs update -- Forwarded message -- Date: Fri, 16 Jun 2000 14:25:47 -0700 From: James Home [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: did I send you this? http://thisishomemade.com/clients/modperl/site very nice, +1 let me know if you need something more from me with regards to this! - J. -- James Home - [EMAIL PROTECTED] http://www.superdeluxe.com http://www.vagabondage.com "There is absolutely no inevitability as long as there is a willingness to contemplate what is happening." - Marshall McLuhan -- Eric Cholet
cvs commit: modperl/Apache Apache.pm
cholet 00/06/15 01:13:37 Modified:Apache Apache.pm Log: backing out $Apache::Server::ConfigTestOnly documentation Revision ChangesPath 1.51 +0 -17 modperl/Apache/Apache.pm Index: Apache.pm === RCS file: /home/cvs/modperl/Apache/Apache.pm,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- Apache.pm 2000/05/19 10:06:07 1.50 +++ Apache.pm 2000/06/15 08:13:36 1.51 @@ -1128,23 +1128,6 @@ Set to true when the server is starting. -=item $Apache::Server::ConfigTestOnly - -Set to true when the server is running in configuration test mode -(Chttpd -t). - - Perl -# don't continue if it's a config test! -print("Skipping the Perl code!\n"), -return if $Apache::Server::ConfigTestOnly; - -print "Running the Perl code!\n" -# some code here - - /Perl - -This variable is not available under Win32. - =back =head1 SEE ALSO
Re: [performance/benchmark] printing techniques
So if you want a better performance, you know what technique to use. I think this last line is misleading. The reality is that you're doing 500,000 iterations here. Even for the worst case scenario of multi_print with no buffering you're managing nearly 22,000 outputs a second. Now granted, the output isn't exactly of normal size, but I think what it comes down to is that the way you choose to print is going to make almost zero difference in any real world mod_perl application. The overhead of URL parsing, resource location, and actually running your handler is going to take far more overhead by the looks of things. I don't understand what you're getting at. Does this mean that something shouldn't be optimized because there's something else in the process that is taking more time? For example I have a database powered site, the slowest part of request processing is fetching data from the database. Should I disregard any optimization not dealing with the database fetches ? These things add up, so don't you think that whatever can be optimized, should ? Of course the slowest stuff should be optimized first, but that doesn't mean that other optimisations are useless. -- Eric
Re: [performance/benchmark] printing techniques
From: "Eric Strovink" [EMAIL PROTECTED] Of course the slowest stuff should be optimized first... Right. Which means the Guide, if it is not already so doing, ought to rank-order the optimizations in their order of importance, or better, their relative importance. This one, it appears, should be near the bottom of the list. From: "Matt Sergeant" [EMAIL PROTECTED] Of course you can optimize forever, but some optimizations aren't going to make a whole lot of difference. This is one of those optimizations, judging by these benchmarks. Let Stas re-write this benchmark test as a handler() and see what kind of difference it makes. I'm willing to bet: barely any between averages. Perhaps I was a little strong: Lets not deprecate this part of the guide, just provide some realism in the conclusion. Agreed, all optimizations should be put under perspective, and the guide (and book :-) should put forward those that count most. This said, i hurry back to s/"constant strings"/'constant strings'/g; -- Eric
Re: [performance/benchmark] printing techniques
These things add up, so don't you think that whatever can be optimized, should ? Wrong question, IMHO: it's what you optimize for that counts. Several things come to mind that are often more important than performance and often mean not optimizing for performance (these are interrelated, of course): Stability / reliability Maintainability Development time Memory usage Clarity of design (API, data structures, etc) I never advocated optimizing at the expense of the above criteria, we were discussing optimizations only. I certainly believe a program is a compromise, and have often chosen some of those criteria as being more important than performance savings. There's a related rule of thumb that says don't optimize until you can test it to see what the slow parts are. Humans are pretty bad at predicting where the bottlenecks are. Neither did I say that optimizations should be carried out without first determining whether they're worth it or not. Run benchmarks, optimize what the benchmark shows to be slow. The point of the discussion was, is it worth it to save a few microseconds here when milliseconds are being spent there. My point was, yes it's worth it, every microsecond counts on a busy site. I think of it this way: if your process spends 80% of it's time in 20% of your code, then you should only be thinking of performance optimizing that 20%, and then only if you identify a problem there. Of course, there are critical sections that may need to operate lightening quick, but they're pretty few and far between outside of real-time, embedded, or kernel hacking. I don't see, provided I have the time and the need (ie my server's resources are strained) why I should not, once I have optimized that 20%, turn to the other 80% and see what I can do there too. - Barrie -- Eric
Re: Data structure question
Using tied hashes, you could conceivably make your own ordered hash class and use that as the data structure you return. You'd still basically have two data structures (for performance) but the fact that it is two data structures would be hidden behind the tied hash which would be programmed to iterate the keys using the array rather than the keys function on the hash part. I think there is source code for this publicly available, but I forget where I saw it. You can get some docs from perldoc perltie though. Tie::IxHash -- Eric
Re: [RFC: performance] Initializing DBI.pm
I've not done much of either this last year, however, I'm hoping to get a new beta DBI release out this week. Maybe... Tim I hope you plan to integrate Doug's patch which makes it possible to use DBI with Perl 5.6 -Dusethreads. Thanks! Of course. And I'll trust you'll all be doing my testing for me... :-) Sure thing, although I doubt many mod_perl users are using Perl 5.6 -Dusethreads in production environments. -- Eric
cvs commit: modperl Changes
cholet 00/06/05 08:42:06 Modified:.Changes Log: document my latest fix Revision ChangesPath 1.496 +3 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.495 retrieving revision 1.496 diff -u -r1.495 -r1.496 --- Changes 2000/06/01 21:17:44 1.495 +++ Changes 2000/06/05 15:41:50 1.496 @@ -10,6 +10,9 @@ =item 1.24_01-dev +fix for 'sub handler : method {}' support when method is not found +[Eric Cholet [EMAIL PROTECTED]] + Apache::ExtUtils will now generate and END routine to call ap_remove_module() [Christopher Chan-N [EMAIL PROTECTED]]
Re: [RFC: performance] Initializing DBI.pm
On Sun, Jun 04, 2000 at 08:58:11PM +0100, Tim Bunce wrote: On Sun, Jun 04, 2000 at 10:57:57PM +0300, Stas Bekman wrote: This all won't be possible without you and other great folks writing and maintaining this amaizing software... So the biggest thanks goes to you :) I've not done much of either this last year, however, I'm hoping to get a new beta DBI release out this week. Maybe... Tim I hope you plan to integrate Doug's patch which makes it possible to use DBI with Perl 5.6 -Dusethreads. Thanks! Tim. -- Eric Cholet
Re: Apache children hanging
On Fri, Jun 02, 2000 at 09:06:02AM +0100, David Hodgkinson wrote: Doug MacEachern [EMAIL PROTECTED] writes: % gdb httpd $pid_of_spinning_process % source modperl_x.xx/.gdbinit % curinfo oops, that should be: % gdb httpd $pid_of_spinning_process (gdb) source modperl_x.xx/.gdbinit (gdb) curinfo Is this magic in the guide? I'm on the bus right now... ;-) I've added it to SUPPORT, and it will be added to the guide soonish. -- Dave Hodgkinson, http://www.hodgkinson.org Editor-in-chief, The Highway Star http://www.deep-purple.com Apache, mod_perl, MySQL, Sybase hired gun for, well, hire - -- Eric Cholet
Re: cvs commit: modperl/src/modules/perl mod_perl.c
On Sat, Jun 03, 2000 at 01:57:26PM -0700, Ask Bjoern Hansen wrote: On 2 Jun 2000 [EMAIL PROTECTED] wrote: Modified:src/modules/perl mod_perl.c Log: fix segfault Don't forget to update Changes. I need some help explaining this change. Here's what happened: % cat t/docs/Foo.pm package foo; sub handler { warn 'foo' } 1; notice the typo, the package declaration says 'foo' instead of 'Foo' % cat t/conf/httpd.conf Location /foo PerlHandler Foo SetHandler perl-script /Location GET /foo will trigger the segfault. Well, under 5.00502 it does, but under 5.6 I get an (expected) 500 internal server error. -- Eric Cholet
cvs commit: modperl SUPPORT
cholet 00/06/02 10:06:39 Modified:.SUPPORT Log: add Doug's snippet about spinning processes Revision ChangesPath 1.15 +11 -0 modperl/SUPPORT Index: SUPPORT === RCS file: /home/cvs/modperl/SUPPORT,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- SUPPORT 2000/03/03 00:30:52 1.14 +++ SUPPORT 2000/06/02 17:06:38 1.15 @@ -157,5 +157,16 @@ Rebuild httpd/mod_perl with PERL_DEBUG=1, let's see a new backtrace. + +=item SPINNING PROCESSES + +If a process is spinning (seemingly stuck in an endless loop, eating +up all cpu), you can use gdb to find which Perl code is causing the +spin: + +% gdb httpd pid of spinning process +(gdb) source modperl_x.xx/.gdbinit +(gdb) curinfo + =back
Re: Jez 'n' Di?
I got a very strange response from [EMAIL PROTECTED] in response to a previous posting to this board. "jez" responded with an "anti spamming notice"! It said the message was tossed into /dev/null, and that it was either because I sent a "ms-tnef" attachment (I sent no attachment at all) or because I was using Word (something I preach against, lol! =o) The message ended with "If neither of the above are the case, then we just don't want to talk to you!!" I wouldn't take it personnally :-) If *you* received a bounce, instead of the list's envelope sender, then it means it's a very broken mail server. If this happens repeatedly the list admin will unsubsribe the offending user. -- Eric
Re: Wierd problem with redirect
On Tue, May 30, 2000 at 02:30:36PM -0700, ___cliff rayman___ wrote: actually \n\r\ is really how it is supposed to be. i am sure you will find it in the RFC's. most browsers seem to be okay with \n's only. Actually it's \r\n, unless you're on a Mac :-) -- Eric Cholet
cvs commit: modperl-2.0/pod - New directory
cholet 00/05/30 15:00:02 modperl-2.0/pod - New directory
Re: Apache::RegistryBB patch for 'use strict'
Apache::RegistryBB from mod_perl-1.24.tar.gz needs a small patch for 'use strict'. diff Apache/RegistryBB.pm.orig Apache/RegistryBB.pm 5c5 use Apache::Constants qw(NOT_FOUND FORBIDDEN OK); --- use Apache::Constants qw(NOT_FOUND FORBIDDEN OK DECLINED); Committed, thanks for the patch! -- Eric
cvs commit: modperl-site index.html
cholet 00/05/21 15:45:50 Modified:.index.html Log: typos Revision ChangesPath 1.57 +4 -4 modperl-site/index.html Index: index.html === RCS file: /home/cvs/modperl-site/index.html,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- index.html2000/05/15 21:06:21 1.56 +++ index.html2000/05/21 22:45:49 1.57 @@ -380,7 +380,7 @@ hr width="40%" align="left" pa name="general-list"/a - bmod_perl mailing list/b is available for + The bmod_perl mailing list/b is available for mod_perl users and developers to share ideas, solve problems and discuss things related to mod_perl and the CODEApache::*/CODE modules. br @@ -456,8 +456,8 @@ hr width="40%" align="left" pa name="advocacy-list"/a - A mailing list for bmod_perl advocacy issues/b, discussions about site and - etc. + A mailing list for bmod_perl advocacy issues/b, + discussions about the site, etc. br The list address for posting is a href="mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED]/a. @@ -720,7 +720,7 @@ /p p - Check out yet another syrvey by + Check out yet another survey by a href="http://www.e-softinc.com/survey/data/index.html" E-Soft /a. (Hint: click on "Apache Module Report")
cvs commit: modperl Changes
cholet 00/05/19 09:01:24 Modified:.Changes Log: document the fact that I fixed what I'd just broken Revision ChangesPath 1.488 +3 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.487 retrieving revision 1.488 diff -u -r1.487 -r1.488 --- Changes 2000/05/19 10:06:04 1.487 +++ Changes 2000/05/19 16:01:22 1.488 @@ -10,6 +10,9 @@ =item 1.24_01-dev +fix broken Win32 build (unresolved external symbol _ap_configtestonly) +[Eric Cholet [EMAIL PROTECTED]] + =item 1.24 - May 16, 2000 'sub handler : method {}' is now treated as a method handler
Re: Win32 mod_perl 1.24 compile error.
Sitting here trying to get 1.24 to compile with VC6, but keep getting stuck with the following linking error; mod_perl.obj : error LNK2001: unresolved external symbol _ap_configtestonly the symbol responsible for the error is in a condition at mod_perl.c line 738. -- mod_perl.c --- 735:perl_tainting_set(s, cls-PerlTaintCheck); 736: (void)GvSV_init("Apache::__SendHeader"); 737: (void)GvSV_init("Apache::__CurrentCallback"); 738:if (ap_configtestonly) 739:GvSV_setiv(GvSV_init("Apache::Server::ConfigTestOnly"), TRUE); 740: 741:Apache__ServerReStarting(FALSE); /* just for -w */ 742:Apache__ServerStarting_on(); --- --- however, if I comment out this condition ( 738 / 739) the compile passes with 0 warnings. Looking at the version 1.22 of mod_perl.c, this condition was not present. Libs:Perl 5.00503 / Apache 1.3.12 Am I missing something here, or can consider my build ok ? This snippet was added recently but apparently ap_configtestonly is not exported in the Apache Windows DLL. Your build is ok, I'll fix this for the next mod_perl version -- Eric
RE: [OT?] Problems making Net::Daemon on Solaris 2.6
I've tried emailing the author but haven't recieved a response. I'm hoping someone will have seen this problem before, or at least be able to point me in the right direction. Solaris 2.7 Perl 5.6.0 I get this when I run make test.: This is totally offtopic. This problem with _PATH_LOG and Solaris came up on comp.lang.perl.moderated a few weeks ago, check news archives the solution was posted. I don't have it handy because I don't use Solaris. t/configYour vendor has not defined the Sys::Syslog macro _PATH_LOG at -- Eric
RE: how do I use perl sections
-Message d'origine- De: Benedict Lofstedt [SMTP:[EMAIL PROTECTED]] Date: jeudi 4 mai 2000 15:38 À:Eric Cholet Cc: [EMAIL PROTECTED] Objet:RE: how do I use perl sections Eric, push @ScriptAlias, [ "/cgi-$_", "/users/$_/cgi-bin" ]; Where can I find better info than given in http://perl.apache.org/src/mod_perl.html#PERL_SECTIONS ? http://www.modperl.com/book/chapters/ch8.html#Configuring_Apache_with_Perl See the paragraph: "Directive is Repeated Multiple Times" Thank you for a quick reply and a good reference. However, it seems that I have found a problem. Even the simplest construct: Perl push @ScriptAlias, "/cgi-benedict/", "/users/benedict/cgi-bin/" ; /Perl but you're not following my example quoted above. @ScriptAlias is a list of aliases. Each alias is a _reference_ to a two-element array. -- Eric
RE: how do I use perl sections
I would like to make a list of ScriptAliases like this ScriptAlias "/cgi-xx" "/users/xx/cgi-bin/" ScriptAlias "/cgi-yy" "/users/yy/cgi-bin/" and did this: Perl my $cgi_users = qw(xx yy); for ($cgi_users) { push @ScriptAlias, "/cgi-$_", "/users/$_/cgi-bin"; } /Perl but it did not work. What is wrong with this Perl section? push @ScriptAlias, [ "/cgi-$_", "/users/$_/cgi-bin" ]; Where can I find better info than given in http://perl.apache.org/src/mod_perl.html#PERL_SECTIONS ? http://www.modperl.com/book/chapters/ch8.html#Configuring_Apache_with_Perl See the paragraph: "Directive is Repeated Multiple Times" -- Eric
RE: Proxy front end behind 64k
OK, I can't figure this out.. help me out here. I want to deal with my virtual hosts on the heavyweight server. The frontend server should just be a simple thing that I never have to touch. Matt, you might want to check out this patch to mod_proxy posted to new-httpd by Sam Tregar: "ProxyRewriteHostHeader option to mod_proxy. This configuration directive controls wether mod_proxy will rewrite the Host header or pass it through unchanged. The default is to rewrite, which is the current behavior. This mirrors a setting available in Squid - redirect_rewrites_host_header." I guess this would let you have your virtual host setup only on the backend server. The patch is against the 1.3 CVS tree. -- Eric Index: src/modules/proxy/mod_proxy.c === RCS file: /cvs/apache/apache-1.3/src/modules/proxy/mod_proxy.c,v retrieving revision 1.69 diff -u -r1.69 mod_proxy.c --- mod_proxy.c 2000/03/01 09:13:38 1.69 +++ mod_proxy.c 2000/05/01 01:48:52 @@ -418,6 +418,8 @@ ps-domain = NULL; ps-viaopt = via_off; /* initially backward compatible with 1.3.1 */ ps-viaopt_set = 0; /* 0 means default */ +ps-rewrite_host_header_opt = 1; /* normally always rewrite */ +ps-rewrite_host_header_opt_set = 0; ps-req = 0; ps-req_set = 0; ps-recv_buffer_size = 0; /* this default was left unset for some reason */ @@ -463,6 +465,7 @@ ps-domain = (overrides-domain == NULL) ? base-domain : overrides-domain; ps-viaopt = (overrides-viaopt_set == 0) ? base-viaopt : overrides-viaopt; +ps-rewrite_host_header_opt = (overrides-rewrite_host_header_opt_set == 0) ? +base-rewrite_host_header_opt : overrides-rewrite_host_header_opt; ps-req = (overrides-req_set == 0) ? base-req : overrides-req; ps-recv_buffer_size = (overrides-recv_buffer_size_set == 0) ? base-recv_buffer_size : overrides-recv_buffer_size; @@ -882,6 +885,26 @@ return NULL; } +static const char* +set_rewrite_host_header_opt(cmd_parms *parms, void *dummy, char *arg) +{ +proxy_server_conf *psf = +ap_get_module_config(parms-server-module_config, proxy_module); + +if (!strcasecmp(arg, "Off")) +psf-rewrite_host_header_opt = 0; +else if (!strcasecmp(arg, "On")) +psf-rewrite_host_header_opt = 1; +else { + return "ProxyRewriteHostHeader must be one of:" + "off | on"; +} + +psf-rewrite_host_header_opt_set = 1; +return NULL; +} + + static const handler_rec proxy_handlers[] = { {"proxy-server", proxy_handler}, @@ -930,6 +953,8 @@ "Force a http cache completion after this percentage is loaded"}, {"ProxyVia", set_via_opt, NULL, RSRC_CONF, TAKE1, "Configure Via: proxy header header to one of: on | off | block | full"}, +{"ProxyRewriteHostHeader", set_rewrite_host_header_opt, NULL, RSRC_CONF, TAKE1, + "Configure handling of Host header. When off the Host header is passed through, +when on the Host header is rewritten based on destination address and pot"}, {NULL} }; Index: src/modules/proxy/mod_proxy.h === RCS file: /cvs/apache/apache-1.3/src/modules/proxy/mod_proxy.h,v retrieving revision 1.46 diff -u -r1.46 mod_proxy.h --- mod_proxy.h 2000/01/11 14:13:44 1.46 +++ mod_proxy.h 2000/05/01 01:48:52 @@ -222,6 +222,8 @@ via_full } viaopt; /* how to deal with proxy Via: headers */ char viaopt_set; +char rewrite_host_header_opt; /* wether to rewrite the Host: header */ +char rewrite_host_header_opt_set; size_t recv_buffer_size; char recv_buffer_size_set; } proxy_server_conf; Index: src/modules/proxy/proxy_http.c === RCS file: /cvs/apache/apache-1.3/src/modules/proxy/proxy_http.c,v retrieving revision 1.67 diff -u -r1.67 proxy_http.c --- proxy_http.c2000/02/29 14:24:27 1.67 +++ proxy_http.c2000/05/01 01:48:52 @@ -172,7 +172,7 @@ const char *strp; char *strp2; const char *err, *desthost; -int i, j, sock, len, backasswards; +int i, j, sock, len, backasswards, sent_host; array_header *reqhdrs_arr; table *resp_hdrs; table_entry *reqhdrs; @@ -307,11 +307,31 @@ ap_hard_timeout("proxy send", r); ap_bvputs(f, r-method, " ", proxyhost ? url : urlptr, " HTTP/1.0" CRLF, - NULL); -if (destportstr != NULL destport != DEFAULT_HTTP_PORT) - ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL); -else - ap_bvputs(f, "Host: ", desthost, CRLF, NULL); + NULL); + +/* if ProxyRewriteHostHeader is off, look for the incoming Host + header and send it along unchanged */ +sent_host = 0; +if (conf-rewrite_host_header_opt_set !conf-rewrite_host_header_opt) { +reqhdrs_arr = ap_table_elts(r-headers_in); +reqhdrs = (table_entry *)
RE: sample modperl script pls
Hi, I want to learn writing modperl scripts. Im not referring to any perl scripts that are executed by Apache::Registry, but rather a perl script that is invoked by the Apache itself - same level like Apache::Registry. You're talking about handlers. The best resource is the Eagle book (http://www.modperl.com/). also, know to fetch the URL. Is it stored in the %ENV? $r-uri 'perldoc Apache' will give you a list of all the API methods. -- Eric
RE: schwartzian
where would an intrepid innocent turn for details on what methods and/or fields are available to the PerlLogHandler in the passed arglist @_ array (okay, $_[0] or shift) ? apparently -last and -request_time and -status ..and $_[0]-last has submethods including get_remote_host, method, the_request, header_in, bytes_sent ..what else is available, and what's the documentation called? $_[0] is the request record, all these methods are Apache methods, 'perldoc Apache' will give you the documentation for them. -last is a pointer to the last subrequest in the request chain. Also see http://www.modperl.com/book/chapters/ch9.html but be aware that the perldoc is more up to date. -- Eric
RE: mod_perl 2.x/perl 5.6.x ?
This is for using Apache 2.0's pthread MPM, of course you can build perl 5.6 non threaded and use apache 2.0's prefork model but then it's not as exciting :-) Does apache 2.0 let you run a prefork model under NT? NT has it's own MPM which is threaded prefork ... Multi Process Model with Preforking (Apache 1.3) dexter Multi Process Model with Threading via Pthreads Constant number of processes, variable number of threads mpmt_pthread .. Multi Process Model with Threading via Pthreads Variable number of processes, constant number of threads/child (= Apache/pthread) spmt_os2 .. Single Process Model with Threading on OS/2 winnt . Single Process Model with Threading on Windows NT I believe the first 3 run only under Unix. -- Eric
RE: Proxy hijackers?
(Off topic again, but lots of people here are using reverse proxy). For a while I had 'ProxyRequests On' in my httpd.conf mistakenly thinking that it was necessary to make ProxyPass and mod_rewrite proxying work. Then I noticed entries in my logfile where remote sites were sending full http://requests to other remote sites. I've turned off the function, but the requests keep coming in, mostly appearing to request ads from somewhere with referring pages in Russia and China. Is this a common practice and what are they trying to accomplish by bouncing them through my server? Yes it is very common practice, and so is scanning for open proxies on ports 80, 8080 and 1080. Here's a link to a list of open proxies and a faq that explains their use. http://www.cyberarmy.com/lists/proxy/ -- Eric
RE: front end proxy and virtual hosts
This leads me to believe that the Rewrite engine is ignored when an Alias kicks in, otherwise the *.shtml files would be bounced back to the back-end server where they get properly expanded. Normally, this is ok for me since everything else in the aliased directory is an image which I want the front end to handle. Has this bitten anyone else? Stas, I think you should mention this in the guide somehow as something to watch out for when using the proxy front-end. The Rewrite rules are ignored when an Alias expands the URI, or so it seems from where I sit. Actually I got bitten by the opposite, my Alias directives are ignored when Rewrite kicks in. I assume it depends on the Apache module order, and as Ask explained when one trans handler returns OK the other is of course ignored, so I too had to convert my Alias statements to rewrite rules. -- Eric
RE: internal_redirect
Hi All I have a module that displays a selection of FORMs for the user to pick from. The FORMs have TARGET='_BLANK'. The submitted form data is sent to a different module which parses the data and uses 'open' to call an external perl script to generate a file and returns the full disk path of the file via STDOUT back to the module. The module then converts that pathname to a local URI which it verifies using $r-lookup_uri($outfile_uri). The module then calls $r-internal_redirect($outfile_uri); return OK; The browser (Netscape 4.7) just spins until it times out with a messages saying "document returned no data". If I paste the URI into a new browser window, the generated file appears as expected. If I set FORM ACTION=/cgi-bin/printenv, for example, the output appears in a new browser window normally. I'm about to try it with IE and also without the TARGET='_BLANK', but I don't expect either of those two changes to help. Does anyone have any suggestions as to which step in this process might be dropping the ball? Thanks in advance Bill Are you using POST in the form by any chance? In which case before you redirect you have to turn that into a GET: if ($r-method eq 'POST') { $r-method('GET'); $r-method_number(M_GET); $r-headers_in-unset('Content-Length'); } -- Eric
front end proxy and virtual hosts
Hi, The front-end light server, serving static requests and proxying dynamic requests to a back-end modperl server, is well documented, except in the case of virtual hosts. How do you do it? Specifically, do you setup virtual hosts on the backend server? Different IPs, or different ports? Or just a flat url space, using mod_rewrite on the front-end to translate the urls? The modperl guide is sadly lacking any information in this area, so your input will be valuable. Thanks, -- Eric
RE: Apache::URI port() problem
Hello, It seems the method unparse() of Apache::URI does not take the port value into the result string. For example, I have: my $uri = Apache::URI-parse($r, $r-uri); $uri-scheme('http'); $uri-hostname($r-get_server_name); $uri-port(8080); $uri-query(scalar $r-args); If I call $uri-unparse(), the string returned does not have port 8080 in it. Can anyone shed some light? Thanks. Fred Xia Can you try this patch? Index: URI.xs === RCS file: /home/cvs/modperl/src/modules/perl/URI.xs,v retrieving revision 1.5 diff -b -u -u -r1.5 URI.xs --- URI.xs 1998/11/13 03:27:52 1.5 +++ URI.xs 2000/04/10 10:57:54 @@ -183,6 +183,9 @@ CODE: get_set_PVp(uri-uri.port_str,uri-pool); +if (items 1) { +uri-uri.port = (int)SvIV(ST(1)); +} OUTPUT: RETVAL -- Eric
RE: front end proxy and virtual hosts
EC do you setup virtual hosts on the backend server? Different IPs, or EC different ports? Or just a flat url space, using mod_rewrite on the EC front-end to translate the urls? I think I posted this example earlier. This is just a snippet of the relevant portions of the front/back end virtual configs. It is not a cookie-cutter example! Basically, I use unique port number virtuals on the back-ends (so I can redirect to localhost: bypassing some networking cruft) and name-based virtuals on the front end, though any technique on the front end will do. I set "Port 80" on the back-end so that any redirects don't get sent directly to the back-end. Sometimes I also bind tightly to address 127.0.0.1 to prevent any outside connections when the two are on the same box. Vivek, Thanks a lot for your input. ### # # Get "real" remote IP address from Proxy and set it as our connection's # IP address so logging, etc., use that IP address. Uses mod_perl handler. # For some reason, must be set per-virtual host. # ### PerlPostReadRequestHandler My::ProxyRemoteAddr This is no longer necessary with mod_perl = 1.22, i.e. it can be put in the main server config and will be inherited (merged) in virtual hosts. -- Eric
cvs commit: modperl-site index.html
cholet 00/04/10 03:15:12 Modified:.index.html Log: Better link for modperl distro Revision ChangesPath 1.49 +3 -3 modperl-site/index.html Index: index.html === RCS file: /home/cvs/modperl-site/index.html,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- index.html2000/04/09 19:07:04 1.48 +++ index.html2000/04/10 10:15:11 1.49 @@ -1,8 +1,8 @@ html head titleApache/Perl Integration Project/title -!-- Last changed: $Id: index.html,v 1.48 2000/04/09 19:07:04 cholet Exp $ -- -!-- Last changed: $Id: index.html,v 1.48 2000/04/09 19:07:04 cholet Exp $ -- +!-- Last changed: $Id: index.html,v 1.49 2000/04/10 10:15:11 cholet Exp $ -- +!-- Last changed: $Id: index.html,v 1.49 2000/04/10 10:15:11 cholet Exp $ -- !-- Last changed: Gerald Richter: 31-Mar-1999 -- STYLE type="text/css"!-- @@ -49,7 +49,7 @@ p -Latest stable release is 1.22, get it from a href="dist/"this site/a or from a href="http://www.cpan.org/"CPAN/a. +Latest stable release is 1.22, get it from a href="dist/"this site/a or from a href="http://www.cpan.org/modules/by-module/Apache"CPAN/a. p
cvs commit: modperl Changes
cholet 00/04/10 07:13:42 Modified:.Changes Log: document change to Apache::URI::port() Revision ChangesPath 1.462 +3 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.461 retrieving revision 1.462 diff -u -r1.461 -r1.462 --- Changes 2000/04/05 06:19:33 1.461 +++ Changes 2000/04/10 14:13:41 1.462 @@ -10,6 +10,9 @@ =item 1.22_01-dev +Apache::URI::port wasn't setting the port correctly, thanks +to Zeqing Xia for the sport [Eric Cholet [EMAIL PROTECTED]] + $Apache::Registry::NameWithVirtualHost fix take 2 (move is_virtual logic from mod_perl.c to Registry.pm) [John Hughes [EMAIL PROTECTED]]
cvs commit: modperl Changes
cholet 00/04/10 07:16:11 Modified:.Changes Log: typo Revision ChangesPath 1.463 +1 -1 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.462 retrieving revision 1.463 diff -u -r1.462 -r1.463 --- Changes 2000/04/10 14:13:41 1.462 +++ Changes 2000/04/10 14:16:11 1.463 @@ -11,7 +11,7 @@ =item 1.22_01-dev Apache::URI::port wasn't setting the port correctly, thanks -to Zeqing Xia for the sport [Eric Cholet [EMAIL PROTECTED]] +to Zeqing Xia for the spot [Eric Cholet [EMAIL PROTECTED]] $Apache::Registry::NameWithVirtualHost fix take 2 (move is_virtual logic from mod_perl.c to Registry.pm)
Re: HTML glitch on perl.apache.org
On Sun, Apr 09, 2000 at 02:32:37PM -0400, Dan McCormick wrote: FYI, there's a missing from the perl.apache.org main page at the line: Latest stable release is 1.22, get it from a href="dist/"this site/a or from a href="http://www.cpan.org/ CPAN -- HERE p It causes the page to read Latest stable release is 1.22, get it from this site or from mod_perl programmers. Which may cause some headscratching. It's fixed, thanks! Dan -- Eric
RE: PerlTransHandler and Files ~ .. sort of mapping
hi, I was wondering how to map PerlTransHandler only for certain type of files. ( I'm doing URI rewriting not URI-filename translation ?!!) Something like : Location Files ~ "xml$" PerlTransHandler Apache::MyHandler /Files /Location Yes I know this is wrong...can this be done in some other way ? Yes, it's wrong because the job of the translation phase is precisely to translate from url to file, therefore it cannot operate on files! PerlTransHandler Apache::MyHandler ... sub handler { my $r = shift; return DECLINED unless $r-uri =~ /\.xml$/; ... } -- Eric
Re: best way to call traceroute
On Fri, Apr 07, 2000 at 11:01:59AM -0700, Karyn Ulriksen wrote: One of the reasons that I always like the nph- construction is that is showed the traceroute 'live' like it would from a console. Last I checked perl doesn't show the traceroute result until the sessions complete which could be a long time if there is trouble in the trace. Did you find a way to get past that? This works for me, showing the results as they come, under Apache::Registry. my $r = shift; $r-content_type('text/html'); $r-send_http_header; ... $|=1; if (open (FILE, "/usr/sbin/traceroute $host 21 |")) { print while FILE; close FILE; } I think there's a Net::Traceroute on CPAN, might want to check that out to avoid the fork. -- Eric -Original Message- From: Sam Carleton [mailto:[EMAIL PROTECTED]] Sent: Friday, April 07, 2000 7:18 AM To: mod_perl Mailing List Subject: Re: best way to call traceroute Steven Champeon wrote: On Fri, 7 Apr 2000, Sam Carleton wrote: I want to call traceroute to the remote_host from within a mod_perl script, being a C/C++ programmer I don't the best way to do that. Is there a traceroute object I could use? If so, how? Otherwise how do I run traceroute from within a perl script? I'm getting ready to port an old and somewhat clunky traceroute CGI script to mod_perl, mostly to avoid the horrid 'nph-' construction. If you'd like I can make the source available. That would be great! Any idea when it will be ready? Sam -- Eric Cholet
RE: authenticated user
How do I get the username someone entered in a http authentication prompt? I got authDBI working, but I can't figure out hot to access the user name which was passed so that I can use it in further sql-dml statements. $r-connection-user(), or $ENV{REMOTE_USER} if you're in CGI emulation -- Eric
RE: retrieving LogLevel?
hi all... I've hunted around and can't find a method that retrieves the LogLevel directive setting. Is there one? If not, is there a record somewhere that can make this available, maybe through Apache::Server? It's not there currently but could easily be. Try this patch: Index: Server.xs === RCS file: /home/cvs/modperl/src/modules/perl/Server.xs,v retrieving revision 1.6 diff -b -u -r1.6 Server.xs --- Server.xs 1999/08/20 08:34:43 1.6 +++ Server.xs 2000/03/28 13:33:34 @@ -113,6 +113,18 @@ # char *error_fname; # FILE *error_log; +# int loglevel; + +int +loglevel(server) +Apache::Server server + +CODE: +RETVAL = server-loglevel; + +OUTPUT: +RETVAL + # /* Module-specific configuration for server, and defaults... */ To be complete I'd also patch Constants.xs to import the relevant LOGLEVEL_XXX constants. Let me know if this works, -- Eric
RE: .makepl_args.mod_perl
A newbie question. Though I have successfully built mod_perl from command line parameters I decided to try the .makepl_args.mod_perl file method from the Eagle book. I had EVERYTHING=1 as the first line in this file but when I run I get... It's makepl_args.mod_perl, not .makepl_args.mod_perl (no leading dot) -- Eric
RE: Undefined of PL_siggv in mod_perl.c
Hi, My environment is apache.1.3.9, mod_perl-1.21, perl5.005_63. When I do make to compile mod_perl-1.21, from src directory, I have the undefine of identifier PL_siggv in the mod_perl.c modul. Is anyone working with the development version of perl5, the perl5.005_63 ? Doesn't any anyone know how to resolve the undefine ? You need to grab the CVS version of mod_perl if you're using perl5.005_63 or anything 5.00503. Grab a snapshot from from perl.apache.org/from-cvs -- Eric
RE: perl.apache.org AWOL?
ObModPerl: I don't seem to have a route to perl.apache.org. Isn't this just a virtual host on www.apache.org? Used to be, but has changed recently. perl.apache.org is now hosted on locus.apache.org. You must have experienced a network glitch, I can access perl.apache.org fine as of this writing. -- Eric
RE: Problems with custom config directives in user written modules
I cannot seem to get custom configuration directives to work in apache (1.3.11) modperl (1.21). I would presume the examples in the book do not work either. I found someone having similar problems in the list archives, to which Doug provided a workaround which also does not work. Any advice about this issue is helpful. Please reply to me directly as well. In Makefile.PL: my @directives = ( ... { name= 'Directive4', errmsg = 'Anything', args_how= 'RAW_ARGS', req_override= 'OR_ALL', }, ); In the httpd.conf file: Perl require Apache::TestDirective; delete $INC{'Apache/TestDirective.pm'}; /Perl #PerlModule Apache::TestDirective Why are you using 'require', and not the PerlModule line you commented out? Directive4 foo What comes back: Invalid command 'Directive4', perhaps mis-spelled or defined by a module not included in the server configuration -- Eric
RE: JOB OPENINGS -- INDIANAPOLIS
Mark, modperl job offers have always been welcome on the modperl list. Please search the archives and you'll find this fact. Cheers, -- Eric hi, i'm not a recruiter, im hiring directly for the company i work for, which, by the way, has put a lot of time and support into helping with mod_perl development. josh Mark Jaaneston [EMAIL PROTECTED] said: Is this a forum where recruiters can spam for new business? I am new here - is the any penalty for these guys? At the very least, I'd like to post references to anti-recruiter job sites. Guys, you can avoid these blood-sucking leeches and get contract and permanent work without having 30-60% of your earning potential stolen from you because they once happened to know somebody that you didn't. Yea, I hate recruiters. Got burned twice, the second by a company that swore up and down they were honest, and they were, for the first contract. Whoops... Sorry, I get a little upset about being raped twice. Do we discourage this type of spam? MJ. At 07:24 AM 2/1/00 -0600, Bobbi Short wrote: Hello. I am a Recruiter with Tech-Pro, Inc. Tech-Pro is a computer consulting services company with offices in Indianapolis, Indiana; Minneapolis, Minnesota; Denver, Colorado; and Phoenix, Arizona. We provide experienced computer professionals on a contract basis. Our consulting staff consists of salaried, hourly and independent contractors. We have immediate opportunities available for mod_perl architects in the Indianapolis area. Ideally, these are contract to hire opportunities with a very large, well known and respected national company. However, for the right candidate, the company is willing to do contract only. If you are interested in learning more about these opportunities, please email me your resume. Be sure to include your phone number and the best time of day to reach you. Thanks for responding. I look forward to hearing from you soon. To learn more about Tech-Pro, please visit our web site at www.tech-pro.com http://www.tech-pro.com . Bobbi Short Tech-Pro, Inc. 8041 Knue Road Indianapolis, IN 46250 Main: (317) 577-4840 Fax: (317) 845-0389 Office locations in Indianapolis, Denver, the Twin Cities, and Phoenix email:[EMAIL PROTECTED] www.tech-pro.com Tech-Pro, Inc. is member of the National Association of Computer Consulting Businesses (NACCB). -- At 07:23 AM 2/1/00 -0800, Josh rotenberg wrote: hi, job i am looking for one or two short to medium term contractors to work on a fairly large scale mod_perl application. the qualified applicant will be able to work in-house (south of market in san francisco) at least most of the time, and be available on a somewhat regular schedule (9-5, 10-6, whatever). in addition to being a perl master and mod_perl ninja, the qualified applicant would also have a firm knowledge of product localization. specifically, i need people with experience in developing applications that support asian languages, so knowledge of asian language encodings is important. the contract will most likely be 3-4 months, full time, with the distinct possibility of a longer contract or full-time employment later on. again, qualifications: * excellent perl skills, OO design and implementation * demonstrated proficiency with mod_perl and apache * solaris and linux experience a must * knowledge of doublebyte character encoding and product localization * firm grasp of MIME and some of the mail RFCs * knowledge of cvs, rpm * ability to work independently, on tight schedules * ability to communicate effectively with those less technical * ability to work in-house in san francisco * ability to wrap c/c++ with xs is a big plus * database stuff is a big plus * C apache module experience a plus please send resumes (text/plain or text/html preferred) to [EMAIL PROTECTED] /job thanks, josh -- josh rotenberg [EMAIL PROTECTED] www.parasite.com - Kenneth Frankel [EMAIL PROTECTED] -- josh rotenberg [EMAIL PROTECTED] www.parasite.com
RE: Trouble installing mod_perl
Hi there, On Sun, 9 Jan 2000, gnielson wrote: I am encountering some errors when trying to get an existing Apache server to support mod_perl. I am running Server version Apache/1.2.4 and perl, version 5.004_01. Is the fact that I have not yet ungraded to 5.004_04 giving me these problems? Didn't I read somewhere that mod_perl (at least v1.2 and later) no longer support Apache 1.2.x? Correct. Perhaps you should think about upgrading. Some of the add-on-goodies on CPAN need at least Perl 5.005_03, but I think you would want to go for a later version than that in any case. No you wouldn't, 5.00503 is the latest stable release. More recent versions are not supported by the current modperl version (1.21). -- Eric
RE: Caching with $r-no_cache(1)
Doug has made the following modification to modperl (in the CVS tree): $r-no_cache(1) will now set the r-headers_out "Pragma" and "Cache-control" to "no-cache" This should work even with buggy browsers. -- Eric I notice that the Guide omits the mention of Netscape's ignorance of Expires: set to the same as Date: when it mentions $r-no_cache(1) performing that function. Currently, I'm experiencing the problem with Netscape 4.7, although I seem to recall the same problem in earlier releases, in the case where the target browser's clock is slow. Of course, the server-side workaround (since we can't just fix our visitor's clocks) is to set an Expires header that significantly in the past, for some definition of 'significant'. I'm going to assume that $r-no_cache(1) won't be kludged to fix Netscape's bug, although some would argue that it should be 'fixed' in mod_perl. As an update to /guide/correct_headers.html#2_1_3_Expires_and_Cache_Control, I'd suggest adding the following text at the end: [ ... works with the major browsers. ] However, Netscape clients with slow clocks may not honor the 'immediate' timeout, cacheing pages anyway. This can be corrected by explicitly setting an Expires header that's in the past. How far in the past depends on how lenient you wish to be with browsers with slow clocks. Something between 5 and 30 minutes seems reasonable to me, but discussion may demonstrate a different approach and/or timeframe. Thoughts? Randy
Re: KeepAlive and mod_perl
On Sat, 18 Dec 1999, Stas Bekman wrote: Lately I've received a few requests to document the KeepAlive directive and its implications on mod_perl behavior. From what I see, mod_perl overrides the whatever settings you have in your config file and sets the KeepAlive to Off. I've tested it with KeepAlive On and KeepAliveTimeout of 15 secs and when I do a raw access by telneting to the port, I get server disconnection as soon as the request is completed. Is this correct? and I should document that KeepAlive directives are irrelevant for mod_perl server (all but static object requests)? That's not what I'm seeing, KeepAlives work the way I configure them. Maybe this is true when accessing a mod_perl server through a front-end proxy, but not when accessing a mod_perl server directly. -- Eric Cholet
Re: [Re: again - more then one PerlTransHandler]
On Thu, 16 Dec 1999, you wrote: Waa!!! So far nobody who answered even doubted that it should be possible to have more then one PerlTransHandler. The "Eagle" book also says that it should be possible. People suggested that either my mod_perl built with wrong flags or I messed up return codes OK/DECLINED (which I didn't!). Is what you saying documented somewhere?!!! Here's a simple test I just ran (with the CVS version of mod_perl, but 1.21 should work as well, although I haven't tested it): Foo.pm: package Foo; sub handler { $r = shift; $r-warn("Foo translating " . $r-uri); return DECLINED; } 1; Bar.pm: package Bar; sub handler { $r = shift; $r-warn("Bar translating " . $r-uri); return DECLINED; } 1; in httpd.conf: PerlTransHandler +Foo PerlTransHandler +Bar after accessing the server, in error.log: [Fri Dec 17 00:44:22 1999] [warn] Foo translating / [Fri Dec 17 00:44:22 1999] [warn] Bar translating / So yes it's possible to have several TransHandlers. -- Eric Cholet
RE: perl-script breaks cgi?
I just ran into a problem I don't understand: I was testing a PerlAccessHandler on a cgi (not modperl) directory like this: Directory /my/user/directory SetHandler perl-script PerlAccessHandler My::Access /Directory Don't use SetHandler for a PerlAccessHandler, it's only for PerlHandlers. when I tried to access a cgi script and got passed the access control I got a message box saying: Unknown File Type You have started to download a file of type application/x-httpd-cgi However when I comment out the SetHandler everything works as intented. Can anyone explain this to me or point me to somewhere where this is explained. (It is probably something very simple, but I must be overlooking it.) Thank you very much, Kees -- Eric