Re: [OT] About XML and Petal (was Re: templating system opinions (axkit?))

2003-07-30 Thread Eric Cholet
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

2003-06-19 Thread Eric Cholet


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?

2003-06-16 Thread Eric Cholet
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...

2002-10-17 Thread Eric Cholet



--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]

2002-09-23 Thread Eric Cholet



--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?

2002-08-30 Thread Eric Cholet

--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.

2002-08-26 Thread Eric Cholet


--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?

2002-08-02 Thread Eric Cholet

--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

2002-07-16 Thread Eric Cholet

--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

2002-04-13 Thread Eric Cholet

--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

2002-04-01 Thread Eric Cholet

--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

2002-04-01 Thread Eric Cholet

--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

2002-04-01 Thread Eric Cholet

--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

2002-03-25 Thread Eric Cholet

--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

2002-03-25 Thread Eric Cholet



--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

2002-02-19 Thread Eric Cholet

--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?

2001-12-28 Thread Eric Cholet

--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




Re: Any good WebMail programs?

2001-12-13 Thread Eric Cholet

 I can use a primer on researching WebMail programs with the following

http://www.astray.com/acmemail/

--
Eric Cholet




RE: Auth Handlers

2001-12-12 Thread Eric Cholet

--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

2001-12-11 Thread Eric Cholet

--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]]

2001-12-04 Thread Eric Cholet

--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?

2001-07-30 Thread Eric Cholet

--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

2001-07-17 Thread Eric Cholet
  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?

2001-07-16 Thread Eric Cholet

--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



Re: perl 5.6 + mod_perl in production environment

2001-07-12 Thread Eric Cholet

--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

2001-04-30 Thread Eric Cholet

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




Re: Unset PerlAuthenHandler (I wish)

2000-12-19 Thread Eric Cholet

  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

2000-12-17 Thread Eric Cholet

 ANNOUNCEMENT: NEW VERSION: HTML::Template 2.1
 
 HTML::Template - a Perl module to use HTML Templates
 

Does it support ELSIF yet?

--
Eric





Re: Question

2000-09-11 Thread Eric Cholet

 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...?

2000-08-18 Thread Eric Cholet

 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

2000-08-17 Thread Eric Cholet

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 ?!?

2000-08-14 Thread Eric Cholet

 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()?

2000-08-05 Thread Eric Cholet

 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?

2000-08-03 Thread Eric Cholet

 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...

2000-07-31 Thread Eric Cholet

 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





Re: PerlSetupEnv is evil

2000-07-24 Thread Eric Cholet

  -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





Re: can't get unbuffered output to work

2000-07-13 Thread Eric Cholet

 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

2000-07-11 Thread Eric Cholet

 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

2000-07-10 Thread Eric Cholet

   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

2000-07-06 Thread Eric Cholet

 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?

2000-07-04 Thread Eric Cholet

 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

2000-06-27 Thread Eric Cholet

 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

2000-06-19 Thread Eric Cholet

 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

2000-06-18 Thread Eric Cholet

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



Re: [performance/benchmark] printing techniques

2000-06-07 Thread Eric Cholet

  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

2000-06-07 Thread Eric Cholet

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

2000-06-07 Thread Eric Cholet

  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

2000-06-06 Thread Eric Cholet

 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

2000-06-05 Thread Eric Cholet

   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





Re: [RFC: performance] Initializing DBI.pm

2000-06-04 Thread Eric Cholet

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

2000-06-03 Thread Eric Cholet

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

2000-06-03 Thread Eric Cholet

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



Re: Jez 'n' Di?

2000-05-31 Thread Eric Cholet

 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

2000-05-30 Thread Eric Cholet

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



Re: Apache::RegistryBB patch for 'use strict'

2000-05-29 Thread Eric Cholet

 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





Re: Win32 mod_perl 1.24 compile error.

2000-05-18 Thread Eric Cholet

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

2000-05-05 Thread Eric Cholet

 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

2000-05-04 Thread Eric Cholet

 -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

2000-05-03 Thread Eric Cholet

 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

2000-05-02 Thread Eric Cholet

 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

2000-04-28 Thread Eric Cholet

 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

2000-04-27 Thread Eric Cholet

 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 ?

2000-04-22 Thread Eric Cholet

  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?

2000-04-19 Thread Eric Cholet

 (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

2000-04-13 Thread Eric Cholet

 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

2000-04-10 Thread Eric Cholet

 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

2000-04-10 Thread Eric Cholet

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

2000-04-10 Thread Eric Cholet

 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

2000-04-10 Thread Eric Cholet

 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




Re: HTML glitch on perl.apache.org

2000-04-09 Thread Eric Cholet

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

2000-04-07 Thread Eric Cholet

 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

2000-04-07 Thread Eric Cholet

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

2000-04-04 Thread Eric Cholet

 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?

2000-03-28 Thread Eric Cholet

 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

2000-02-04 Thread Eric Cholet

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

2000-02-03 Thread Eric Cholet

 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?

2000-02-02 Thread Eric Cholet

 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

2000-02-01 Thread Eric Cholet

 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

2000-02-01 Thread Eric Cholet

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

2000-01-10 Thread Eric Cholet

 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)

2000-01-07 Thread Eric Cholet

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

1999-12-18 Thread Eric Cholet

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]

1999-12-16 Thread Eric Cholet

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?

1999-12-15 Thread Eric Cholet

 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



Re: Problems building

1999-12-15 Thread Eric Cholet

On Wed, 15 Dec 1999, you wrote:
 Hi all,
 
 On 14 Dec 1999, Greg Stark wrote:
 
  I think the interdependence with the apache tree and the mod_perl
  tree just makes things too complicated. I'm not unfamiliar with
  complicated building software -- even fairly complex software, but
  mod_perl just plain won that weekend, I conceded defeat.
  
  It doesn't help that there are at least two completely different
  ways to build each. I would suggest narrowing it down to just one
  right way to build apache.  If the shared module can't be made rock
  solid then I suppose one way for shared module and one for compiling
  statically into apache. But I would suggest throwing out the
  PREP_HTTPD and DO_HTTPD stuff and the option to not use apaci.
 
 Hear, hear.
 Is there an echo in here?

Yes, here's one: I'm strongly opposed to this suggestion. I have always built
mod_perl + apache in one single step (perl Makefile.PL EVERYTHING=1 DO_HTTPD=1
 make install), I like the fact that I install just the binary httpd wherever
I feel like, I don't want it to go away.

If you're concerned about the two different ways to build, hop on over to
Apache-land, they started it :-)

--
Eric



RE: Trouble in proxyland

1999-12-10 Thread Eric Cholet

Dave Hayes wrote:
 On Fri, 6 Aug 1999, Vivek Khera wrote:
  Running Apache/1.3.7-dev (Unix) mod_perl/1.19_01-dev, it seems that
  PerlPostReadRequestHandler is virtual-host bound.
 
 Yep, and I really have to ask why this is implemented in this fashion?

Because mod_perl lacks a per-server merge configuration merge function.

 Turns out I beat my head against the wall for a few hours until I
 found this mail message. Is there a way to globalize this parameter
 (i.e. allow this handler to be set outside of a virtual host section)?

Yes it's fixed in the CVS tree. If a PostReadRequest handler is installed in
the main server config, it will be used by vhosts, unless they define
their own.

--
Eric



RE: Problem with compiling mod_perl

1999-12-08 Thread Eric Cholet

 I must have now installed mod_perl a dozen times on a dozen machines and 
this is the first time I've come across this problem and I can't seem to 
solve it...nor have I had any luck through FAQs, DejaNews or even newsgroup 
postings :(

 I have an RH Linux 6.1 box.  I currently have Apache 1.3.9 running on the 
server.  My problem is when I attempt to compile mod_perl...this is what I 
get...

 snip
 SSL_BASE=/usr/local perl Makefile.PL EVERYTHING=1 DO_HTTPD=1
 Appending mod_perl to src/Configuration
 Using config file: /usr/home/sysadm/mod_perl-1.21/src/Configuration
 Creating Makefile
  + configured for Linux platform
  + setting C pre-processor to gcc -E
  + checking for system header files
  + adding selected modules
 o ssl_module uses ConfigStart/End
   + SSL interface: mod_ssl/2.4.9
   + SSL interface build type: OBJ
   + SSL interface compatibility: disabled
   + SSL interface experimental code: disabled
   + SSL interface vendor extensions: disabled
   + SSL interface plugin: Configured DBM (-ldbm)
   + SSL library path: /usr/local
   + SSL library version: OpenSSL 0.9.4 09 Aug 1999
   + SSL library type: installed package (stand-alone)
   + SSL library plugin mode: none
  + enabling Extended API (EAPI)
  + checking sizeof various data types
  + doing sanity check on compiler and options
 ** A test compilation with your Makefile configuration
 ** failed. This is most likely because your C compiler
 ** is not ANSI. Apache requires an ANSI C Compiler, such
 ** as gcc. The above error message from your compiler
 ** will also provide a clue.
 /snip

 This DOES NOT happen if I attempt to compile Apache on it's own...this 
error only occurs when I attempt to do an HTTPD build through mod_perl. 
 Now the one thing I have discovered is 95% of the time the test 
compilation error is not because of the compiler not supporting ANSI (I'm 
using the latest gcc btw) but is just something failed in the compiling 
whether it be a configuration error, problem running a function etc...  The 
main problem is that I don't receive any additional error messages so I 
don't know what the real problem is.  I have also tried using gcc with the 
-ansi switch as well just to be on the safe side but that didn't help 
either.

 Has anyone ever encountered anything like this before?  Or have any ideas 
on what may be causing this error?

Apache was recently patched so that the original error mesage is
printed out, because as you say it's often not a problem with the
compiler being ANSI or not. So you might want to grab a CVS snapshot
of Apache, unless you can wait for 1.3.10 which will be out in a couple
of weeks I believe.

--
Eric



RE: HTTP_REFERER is gone under Mod_Perl and EmbPerl!

1999-12-06 Thread Eric Cholet

 I have Apache 1.3.9 and Mod_Perl 1.2.1 and EmbPerl 1.2.0.
 
 The environment variable HTTP_REFERER is not in my scripts' CGI 
 environment.
 
 I tried both regular Perl and Mod_Perl and it doesn't show up 
 anywhere.  I've searched the Net for any mention of this and found 
 none.  
 
 Can anyone give me a hand on how to debug this?

Maybe it's an environment setup problem, anything in $r-header_in("Referer")
under mod_perl?

--
Eric



RE: LWP vs Netscape

1999-12-03 Thread Eric Cholet

 hi,
 
 If I put this on Location: bar on the Netscape browser, I get the result
 of the search as expected (try it).
 
http://www.volunteermatch.com/results/results.jtmpl?zip=5radius=60when=30ongoing=bcategory=Everythingsubmit=Search

I don't, I get the search form. Using IE5 on Win98.

 
 
 But If I try to do this via LWP package, I didn't get the result page,
 but the FORM that is used to create this query(something is going
 wrong). Why ?!?!? What also is nesecary to send to the Web server, some
 Headers or what ?? Which ?
 I even got this result if I try the same query via telnet ?
 
 #!/usr/bin/perl
 use LWP::UserAgent;
 my $UA = new LWP::UserAgent;
 #$UA-agent("Agent/007:)");
 
 my $req = HTTP::Request-new(GET =
 
'http://www.volunteermatch.com/results/results.jtmpl?zip=5radius=60when=30ongoing=bcategory=Everythingsubmit=Search'
 );
 my $result = $UA-request($req);
 print $req-as_string;
  if ($result-is_success)
   {
$bb = $result-content . "BR\n";
$bb =~ s/^.*body bg(.*)\/body.*$/$1/is;
print $bb;
   }
else {print "no success\n";}
 
 
 
 
 THANX
 =
 iVAN
 [EMAIL PROTECTED]
 =
 




mod_perl Programmers demand is going up...

1999-12-03 Thread Eric Cholet

Randal L. Schwartz wrote:
 For some people, I presume dealing only with content handlers could be
 considered as "mod_perl experience".  But mod_perl is so much more
 than the content phase.  I would laugh at someone that said they "knew
 mod_perl", but couldn't tell me most of what's in Stas' document, for
 example, or had never written a PerlTransHandler or a PerlLogHandler.
 Or worse yet, had only used Apache::Registry!
 
 aside - Doug did too good of a job with Apache::Registry.  So many
 people think that this is all mod_perl is and forget that
 Apache::Registry is just a stopgap while you are writing *real*
 handlers.

Many people make the distinction between Apache::Registry being for
mod_cgi compatible scripts, and "real" handlers taking full power of
the Apache API. The truth is that an Apache::Registry script can also
use the Apache API and completely disregard CGI compatibility.
When I write a new application, I often write content handlers as
registry scripts, because of the ease of use (no need to restart the
server when changed), then it's easy to wrap a "sub handler" around the
script to turn into a "real" handler.

--
Eric



RE: conf file precedence

1999-12-02 Thread Eric Cholet

 I have the following in my conf file:
 
 # Framed applications
 ProxyPass /frames http://sw3.tivoli.com:81/frames
 ProxyPassReverse /frames http://sw3.tivoli.com:81/frames
 
 # Begin Apache::ProxyStuff stuff
 PerlModule Apache::ProxyStuff
 
 Location /
 SetHandler  perl-script
 PerlHandler Apache::ProxyStuff
 PerlSetVar  HeaderFile  /includes/home_top_table.html
 PerlSetVar  FooterFile  /includes/footer.html
 PerlSetVar  BodyAttributes  "TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0
 MARGINWIDTH=0"
 PerlSetVar  ProxyPrefix http://sw3.tivoli.com:81
 /Location

[snip] 

 The problem I've run into is even though I've set up ProxyPass rules for
 /frames it's getting handled by Apache::ProxyStuff. I though apache would apply
 the most specific rule (in this case /frames over /) but that doesn't seem to
 be happening. I tried moving the ProxyPass stuff to the end of the file in
 hopes it would take the last rule that applied but that didn't work either.

This recent change to Apache _may_ explain it (I'm not sure, haven't tried it):

  +  *) Fix problem with proxy configuration where globally set configuration
  + options were overridden inside virtual hosts.
  + [Graham Leggett [EMAIL PROTECTED]]
  +

Before that change mod_proxy didn't merge per-directory configuration at request
time. Could you try a CVS snapshot of Apache and see if that fixes your problem?

--
Eric



RE: PerlLogHandler - bytes always zero for proxy requests

1999-12-01 Thread Eric Cholet

 I presume from the lack of response that nobody knows the answer to this
 one? Or have I sent this to the wrong mailing list?  Or is it a stupid
 question?
 
 Best Regards,
 
 Brian
 
 "Brian S. Craigie" wrote:
 
  Can anyone tell me how to turn on logging of the bytes through the proxy
  please?
 
  Many thanks,
 

Check out the Apache doc for module mod_log_config, directive LogFormat.
The format specifier %b or %B is what you're looking for.

--
Eric



RE: Questions

1999-11-24 Thread Eric Cholet

 Hi,
 a couple of questions.
 I can't get the $ENV{REMOTE_USER} var., after succesfull
 authentification - there is nothing in it.
 Here is the configuration :
 
 VirtualHost 127.0.0.1
 ...blah 
 .blah ...
 Directory /work/volunteer/members
  AuthDBUserFile /work/.volunteers.db
  AuthGroupFile /dev/null
  AuthName 'Volunteers Members Area'
  AuthType Basic
  Limit GET
   require valid-user
  /Limit
 /Directory
 /VirtualHost

I don't know why $ENV{REMOTE_USER} isn't set, but since you're using
mod_perl you can use $r-connection-user.
BTW are you sure you need that Limit GET section? One could use
POST, or some other method to circumvent your authentication.
 
 Third question :
  Is there a way to tell Apache to reparse a handler, when I change the
 source.
  Not to "/etc/rc.d/init.d/httpd restart"  - every time.

Use PerlFreshRestart, or Apache::StatINC.
 
--
Eric



RE: mod_perl messages in error_log

1999-11-22 Thread Eric Cholet

 What means
 
   mod_perl: rwrite returned -1 (fd=3, B_EOUT=8)
 
 in the error_log file?

It means the client disconnected before your script ended.
There's a bug that makes this message appear unduly, which has
(hopefully) been fixed in the CVS tree.
 
 I'm adapting the Apache::Ticket* family of modules to a new site
 authenticating against a PostgreSQL database with DBI.  The modules
 seem to work, but these cryptic messages appear when
 Apache::TicketMaster performs some of its tasks.
 
 The values in the error message do not vary from one instance to the
 next.
 
 TIA.
 
 -- 
 Brian Haney  [EMAIL PROTECTED]
 CyberNautix, Inc.   800.7.NAUTIX
 UNIX/Internet Computing Solutions   Consulting * Development
 

--
Eric



RE: Does no_cache really deny caching?!

1999-11-16 Thread Eric Cholet

 Hello,
 
 I would like to deny caching of pages which are under access control.
 So, I looked at no_cache and browsed through the http header
 produced by this method.
 
 As far as I discovered, no_cache(1) behaves like the A option of
 mod_expires. The httpd header field looks like
 
 Expires:   current date and time
 
 I am not able to manage that all proxies set the time correclty. Most likely
 the time settings are different because only a few servers are connected
 to an NTP time source. This is even more important if a few servers
 doesn't support daylight saving time correctly.
 
 Wouldn't it be better to behave like the M option of mod_expires, e.g.
 to set the last modification date or maybe the hard way:
 set an artificial date like 01/01/1980 (that's what I did for myself via
 $r-header_out)?!

I raised this issue on this list about a year and a half ago, and Ask
forwarded it to the Apache Group, where it was rejected because the semantics
of no_cache can't just be altered this way. You can lookup the exact reason
in the archives :-)

This works for me:

  my $headers = $r-headers_out;
  $headers-{'Pragma'} = $headers-{'Cache-control'} = 'no-cache';
  $r-no_cache(1);
 
 Steffen

--
Eric



RE: Support of CR LF in a EBCDIC environment

1999-11-15 Thread Eric Cholet

I'm not familiar with EBCDIC, but in Perl \r and \n are platform
dependent, you migh want to try the platform independent \015 (cr)
and \012 (lf). 

[EMAIL PROTECTED] wrote:
 
 Dear list readers - 
 
 I'm working with the following environment:
 
 BS2000-Posix as O.S.
 Perl-5.005_54
 Apache-1.3.9
 Mod_perl-1.21
 
 BS2000-Posix has the EBCDIC as character set, both Apache-1.3.9 and
 perl-5.005_54 are ported to support EBCDIC code.
 
 I installed Apache with mod_perl and tried the counter example of the
 mod_perl guide:
 
 #!/usr/local/bin/perl -w  
 use strict;   
   
 print "Content-type: text/html\r\n\r\n";  
   
 my $counter = 0;  
   
 for (1..5) {  
   increment_counter();
 } 
   
 sub increment_counter{
   $counter++; 
   print "Counter is equal to . $counter !BR\n"; 
 }
 
 The result that I have is:
 
 HTTP/1.1 200 OK 
 Date: Mon, 15 Nov 1999 09:36:57 GMT 
 Server: Apache/1.3.9 (BS2000) mod_perl/1.21 ApacheJServ/1.0 
 Connection: close   
 Content-Type: text/plain
 
 Counter is equal to . 1 !BR   
 Counter is equal to . 2 !BR   
 Counter is equal to . 3 !BR   
 Counter is equal to . 4 !BR   
 Counter is equal to . 5 !BR   
 Connection closed by foreign host.
 
 The content-type is text/plain instead text/html, mod_perl loses this header
 probably due to EBCDIC conversion of the "\n" character. Trying with
 print "Content-type: text/html\r\n";
 or with
 print "Content-type: text/html\r\r\n";
 the content-type is text/html, as it should be.
 
 I looked the sources of mod_perl for some part where the mod_perl is
 preparing the headers from the output of perl5 and to pass them to the
 apache. I don't understand who is doing that. Can someone help me to find
 where the content-type header is lost.
 
 -- Ignasi Roca




RE: DigExt in user-agent hammering my site

1999-11-03 Thread Eric Cholet

Randal,

This is a nice package, but I have some questions:

   my $host = $r-get_remote_host;
   return DECLINED if $host =~ /\.(holdit|stonehenge)\.com$/;

You have host name lookups turned on? That's not very performance friendly.
And you've just published how to get around your throttler: all I need to
do is change my reverse DNS to some name in one of your domains.
You can't trust external DNS information.

Also, isn't all this file i/o for every request also bad for performance?

Anyway it's a nice method that I think I'll adapt to a problem I have, which is
to detect and stop dictionnary attacks on a password protected site. In that
case the throttling needs only be applied when authentication has failed and
thus won't affect performance for normal requests.

Thanks for the code,
--
Eric


 Nope, I could find nothing to distinguish "evil spider" mode from
 normal browsing mode, other than the rapidity of the download
 requests.
 
 So, I wrote my own throttling routines, unsatisfied with the others
 that I found...
 
 package Stonehenge::Throttle;
 use strict;
 
 ## usage: PerlAccessHandler Stonehenge::Throttle;
 
 my $HISTORYDIR = "/home/merlyn/lib/Apache/Throttle";
 
 my $WINDOW = 90;  # seconds of interest
 my $SLOWBYTES = $WINDOW * 2000;   # bytes before we sleep
 my $SLEEP = 1;# sleep time
 my $DECLINEBYTES = $WINDOW * 3000; # bytes before we 408 error
 
 use vars qw($VERSION);
 $VERSION = (qw$Revision: 1.4 $ )[-1];
 
 use Apache::Constants qw(OK DECLINED);
 use Apache::File;
 use Apache::Log;
 
 use Stonehenge::Reload;
 
 sub handler {
   goto handler if Stonehenge::Reload-reload_me;
 
   my $r = shift;
   return DECLINED unless $r-is_initial_req;
   my $log = $r-server-log;
 
   my $host = $r-get_remote_host;
   return DECLINED if $host =~ /\.(holdit|stonehenge)\.com$/;

 
   my $historyfile = "$HISTORYDIR/$host"; # closure var
 
   $r-register_cleanup
   (sub {
  my $fh = Apache::File-new;
  open $fh, "$historyfile" or return DECLINED;
 
  my $time = time;
  my $bytes = $r-bytes_sent;
  syswrite $fh, pack "LL", $time, $bytes;
  close $fh;
 
  return OK;
});
 
   {
   my $startwindow = time - $WINDOW;
   my $totalbytes = 0;
   my $fh = Apache::File-new;
   open $fh, $historyfile or return DECLINED;
   while ((read $fh, my $buf, 8)  0) {
 my ($time, $bytes) = unpack "LL", $buf;
 next if $time  $startwindow;
 $totalbytes += $bytes;
   }
   if ($totalbytes  $DECLINEBYTES) {
 $log-notice("$host got $totalbytes in $WINDOW secs, sending 503");
 $r-header_out("Retry-After", $WINDOW);
 return 503;   # Service Unavailable
   } elsif ($totalbytes  $SLOWBYTES) {
 $log-notice("$host got $totalbytes in $WINDOW secs, sleeping for $SLEEP");
 sleep $SLEEP;
 return DECLINED;
   } else {
 ## $log-notice("$host got $totalbytes in $WINDOW secs"); # DEBUG
 return DECLINED;
   }
   }
   return DECLINED;
 }
 1;
 
 This has to be aided by a cron script run every 20 minutes or so
 that looks like this:
 
 #!/usr/bin/perl -w
 use strict;
 
 # $Id: throttle-cleaner,v 1.1 1999/10/28 19:44:09 merlyn Exp $
 
 my $DIR = "/home/merlyn/lib/Apache/Throttle";
 my $SECS = 360;   # more than Stonehenge::Throttle $WINDOW
 
 chdir $DIR or die "Cannot chdir $DIR: $!";
 opendir DOT, "." or die "Cannot opendir .: $!";
 my $when = time - $SECS;
 while (my $name = readdir DOT) {
   next unless -f $name;
   next if (stat($name))[8]  $when;
   ## warn "unlinking $name\n";
   unlink $name;
 }
 
 So now I have a bytes-served-in-window throttler on my website that
 prevents anyone from sucking down more than 3k/sec sustained over 90
 seconds from any specific IP.
 
 It triggered five times overnight.  But my ISP neighbors are now
 happy.
 
 I should clean up Stonehenge::Throttle and submit it.  Notice, no file
 locking!  That was an interesting fallout of the design.
 
 -- 
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
 See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
 




RE: Hello

1999-11-03 Thread Eric Cholet

Javier Viveros:
 Hi from Paraguay. Did anyone wrote a chat client with mod_perl??? I am on
 that project now, and it will be helpfull to read another source code.
 Greetz and sorry for my poor english level.

I have written a chat server and client that works with modperl.I plan to
release it but it needs a little polishing before I can do that.
Email me privately if you're interested.

--
Eric
 




RE: Installing libwww

1999-10-29 Thread Eric Cholet

Man, that's some ps program you've got here. I should run Linux
one of these days.

   PID TTY STAT TIME COMMAND
 1  ?  S0:05 init [2]
 2  ?  SW   0:06 (kflushd)
 3  ?  SW   0:07 (kupdate)
 4  ?  SW   0:00 (kpiod)
 5  ?  SW   0:04 (kswapd)
82  ?  S0:00 /sbin/syslogd
84  ?  SW   0:00 (klogd)
90  ?  S0:00 /usr/sbin/inetd
   369  ?  R0:00  \_ in.telnetd: cobra.ssu.samara.ru [vt100]
   370  p1 S0:00  \_ -tcsh
  6580  p1 S0:00  \_ screen
  6581  ?  R0:00  \_ SCREEN
  6582  a0 S0:00  \_ -/usr/bin/tcsh
  6583  a0 S0:00  |   \_ -tcsh
  6633  a0 S0:00  |   \_ make test
  6656  a0 S0:00  |   \_ /usr/bin/perl t/TEST 0
  6679  a0 S0:00  |   \_ /usr/bin/perl -w
 robot/ua.t
  6680  a0 Z0:00  |   \_ (perl zombie)
  6672  a1 S0:00  \_ -/usr/bin/tcsh
  6683  a1 S0:00  \_ -tcsh
  6699  a1 R0:00  \_ ps axf



RE: Generic Server

1999-10-29 Thread Eric Cholet

 I'll use POP3 as my example, although any other service (eg telnet, ssh, 
FTP, SMTP) are equally valid.

 Having apache run on a non-http port, say port 110 (POP3), could be 
handy.  You could even have POP3 running elsewhere and use the POP3 module:
  o  to proxy POP3 requests inside a firewall, or
  o  to proxy to a POP3 running on a non-standard port (eg 10110), or
  o  to get POP3 mail from multiple accounts!
 Imagine, a custom mod_perl POP3 server which grabs mail from all
 your email boxes all over the net.

 There are two major stopping points from being able to do this today with 
Apache/mod_perl:

  [1] POP3 clients do not send HTTP headers.  Is there already a
  way in mod_perl to get a request before the HEADERS are parsed?

  [2] POP3 clients have 'interactive' connections.  Is there a way in
  apache/mod_perl to read/write more info from a socket without
  dropping the connection?


The whole Apache request model doesn't map at all well into the POP3 model.
You just can't fit the POP3 dialog in the http request model, it's not just
the headers. The hook has to be at a lower level. You have a core engine 
that
handles the process/threading, listens and dispatches incoming connection.
This is where a new pop3 core code steps in. You need to define you own
abstraction for POP3 concepts. You won't have one request, but many. The 
phases
will be different. Once this is implemented and has appropriates hooks and 
a
nice API, you can start writing mod_perl_pop3 which embed the perl 
interpreter
and lets you write pop3 perl scripts.

Actually IIRC apache 2 already has a protocol-independant core with hooks
that can hand over a connection to a specific protocol handler. I don't 
know
however the extent of the support, e.g. for dispatching to modules.

  Matt Sergeant [EMAIL PROTECTED] wrote:
  Would it be possible to have a generic server, like Apache, but not 
just
  for HTTP - something that could also serve up NNTP connections, FTP
  connections, etc. It seems to me at first look this should be 
possible.
  
  As I can see it there's a few key components to Apache:
  
  forking tcp/ip server
  file caching/sending
  header parsing
  logging

I'll add to this list:

configuration
module management
generic i/o

I'm not sure I see how header parsing is a generic thing. Seems to me
different protocols handle headers in different ways, at different times.


  Not wacko. Although it may not be desirable, at least in the way you
  envision. Say there's a bug in one of your HTTP mod_perl modules, do 
you
  want to lose SMTP?

I'd want to dedicate one pool of processes to SMTP trafic, and another to
HTTP, since the resource requirements are different.

 You could have *two* apaches running, one on port 80 and another on port 
25 (SMTP).

Actually to run a useful SMTP server you pretty much have to use port 25 
:-)

Now, a mod_perl enabled SMTP server would be very cool. Forget canonical 
maps,
write a PerlAddyHandler!

--
Eric



  1   2   >