RE: Apache::DBI

2000-06-21 Thread Eric Jain

> > Is it be possible to modify Apache::DBI in sich a way that only
> > database connections specified in a PerlRequired startup.pl with
> > Apache::DBI->connect_on_init(...) are stored and all subsequent
> > DBI->connect(...) connections are properly established
> (if no matching
> > stored connection is available), but not stored afterwards?
>
> I'm not sure why you would want to do such a thing, but I
> don't think it
> fits with DBI/Apache::DBI's model...
>
> why exactly are you looking for this behavior?

Currently I don't use Apache::DBI, even though 99% of all connections
are made as the same user, since I have a few users log in and connect
with their own usernames. This would lead to every process having
several open connections, using up lots of precious RAM...


--
Eric Jain





Apache::DBI

2000-06-21 Thread Eric Jain

Is it be possible to modify Apache::DBI in sich a way that only
database connections specified in a PerlRequired startup.pl with
Apache::DBI->connect_on_init(...) are stored and all subsequent
DBI->connect(...) connections are properly established (if no matching
stored connection is available), but not stored afterwards? Or could
Apache::DBI::db::disconnect be changed, so it would actually
disconnect, except if it was handling one of the connect_on_init
connections?


--
Eric Jain




Re: garbled redirections

2000-06-20 Thread Eric Cholet

> Hello, all.
>
> First, the problem:
> 
> [Tue Jun 20 09:06:55 2000] [error] [client 90.17.209.65] Invalid error
> redirection directive: üØ@
> 
>
> üØ@? Let me assure you, "üØ@" isn't in my code anywhere. =o)
>
> I am, however, using a PerlPostReadRequestHandler that currently looks
> much like this:
> 
>
> package Apache::PortCorrect;
>
> use strict;
> use Apache::Constants qw( :response :methods );
> use Carp ();
> $SIG{__WARN__} = \&Carp::cluck;
>
> sub handler {
>  my($r,$s,$url,$args,$uri,$subr);
>  $r = shift;   # the request object
>  return OK if 443 == $r->get_server_port;
>  (undef,$url,undef) = split(/\s+/o, $r->the_request);
>  return OK if $url =~ m{ ^(?:/ # doc root
>| /(list|of|ok|dirs)/.* # edited
>| /(page|list)[.]shtml  # ditto
>| .*[.](gif|jpg)
>)$
>}ixo;
>  $uri = "https://our.intranet.com" . $url; # again
>  $args = $r->args;
>  $uri .= "?$args" if $args;
>  $r->custom_response(MOVED,$uri);
>  return MOVED;
> }
>
> 1; # guarantee return code for load
> 
>
> Am I confusing or crosswiring Apache by doing a cross-port custom
> response here?  It seems to work
>
> Or is it something entirely different?

I don't think you can want custom_response here, it does an internal
redirect. You want to do an external redirect, so use
$r->header_out(location => ...)

--
Eric





Re: PerlChildInitHandler

2000-06-20 Thread Eric Cholet

> Hi!
>
> > > Is it possible to pass variables defined with PerlSetVar to a
> > > PerlChildInitHandler ?
> > > If not, is there any other way to define variables in such a handler than
> > > hardcoding values into the .pm?
> > 
> > You can use Apache->server->dir_config() to access per-server config
> > variables.
> This doesn't work:
>  Can't locate object method "dir_config" via package "Apache::Server" 
> 
> I have tried 
> Apache->server->dir_config()
> and 
> $s=Apache->server;
> $s->dir_config;
> 
> Am I using an old version of mod_perl?
>   Perl version 5.00404 for Apache/1.3.9 (Unix) mod_perl/1.21

Yes, this feature was added in mod_perl 1.21_01

--
Eric





Re: PerlChildInitHandler

2000-06-20 Thread Eric Cholet

> Hi!
> 
> Is it possible to pass variables defined with PerlSetVar to a
> PerlChildInitHandler ?
> If not, is there any other way to define variables in such a handler than
> hardcoding values into the .pm?


You can use Apache->server->dir_config() to access per-server config
variables.

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





APACHE::ASP intermittent problem uploading images (CGI.pm)

2000-06-17 Thread Eric B



Using Apache::ASP (latest build) I have problems uploading images.
Sometimes, I get the following error through the http channel, (same error
is seen in error-log)

Errors Output
> Undefined subroutine CGI::upload
, /usr/local/libdata/perl5/site_perl/Apache/ASP.pm line 1229

Clearly, this stems from my use of CGI.pm in my ASP page.

my ($q) = new CGI;

(  }

my ($upfile) = $q->upload("newimage");

But... this is kind of strange because it only occurs SOMETIMES.  And it
does not occur in a standard perl script.

I included a dump of my config below.

Thanks,

Eric

-

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
osname=openbsd, osvers=2.6, archname=i386-openbsd
uname='openbsd'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
cc='cc', optimize='-O2', gccversion=2.95.1 19990816 (release)
cppflags=''
ccflags =''
stdchar='char', d_stdstdio=undef, usevfork=true
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='ld', ldflags =''
libpth=/usr/lib
libs=-lm -lc
libc=/usr/lib/libc.so.23.1, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=define, ccdlflags=' '
cccdlflags='-DPIC -fPIC ', lddlflags='-Bforcearchive -Bshareable '


Characteristics of this binary (from libperl):
  Built under openbsd
  Compiled at Oct 31 1999 11:41:08
  @INC:
/usr/libdata/perl5/i386-openbsd/5.00503
/usr/local/libdata/perl5/i386-openbsd/5.00503
/usr/libdata/perl5
/usr/local/libdata/perl5
/usr/local/libdata/perl5/site_perl/i386-openbsd
/usr/libdata/perl5/site_perl/i386-openbsd
/usr/local/libdata/perl5/site_perl
/usr/libdata/perl5/site_perl

-

Server version: Apache/1.3.12 (Unix)
Server built:   Jun 17 2000 16:03:54
Server's Module Magic Number: 19990320:7
Server compiled with
 -D HAVE_MMAP
 -D HAVE_SHMGET
 -D USE_MMAP_SCOREBOARD
 -D USE_MMAP_FILES
 -D USE_FLOCK_SERIALIZED_ACCEPT
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D HTTPD_ROOT="/usr/local/apache"
 -D SUEXEC_BIN="/usr/local/apache/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_XFERLOG="logs/access_log"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
 -D ACCESS_CONFIG_FILE="conf/access.conf"
 -D RESOURCE_CONFIG_FILE="conf/srm.conf"

-
And, from my httpd.conf:




#SetHandler perl-script
AddHandler perl-script .asp
PerlSetVar Filter On
PerlHandler Apache::ASP Apache::SSI
PerlSetVar Global /home/euro/asp
PerlSetVar DynamicIncludes 0
PerlSetVar StateDB DB_File
PerlSetVar GlobalPackage main
PerlSetVar UseStrict 0
PerlSetVar Debug 2
PerlSetVar StatINC 0


Options Includes ExecCGI FollowSymLinks
#Options Indexes FollowSymLinks ExecCGI Includes
#AllowOverride AuthConfig Limit
#Order allow,deny
Allow from all





Re: proxy requests via mod_proxy

2000-06-14 Thread Eric Cholet

> In the startup.pl of the app server:
>
> sub My::ProxyRemoteAddr ($) {
>my $r = shift;

you'll want to insert this here:
# we'll only look at the X-Forwarded-For header if the requests
# comes from our proxy at localhost
return OK unless ($r->connection->remote_ip eq "127.0.0.1");

it's in the latest mod_proxy_add_forward, maybe you're using an older
version. This makes sure an outsider cannot defeat any IP-based
authorization
by connecting directly to the backend and supplying a forged X-Forwarded-For
header. Of course this is moot if the backend is bound to 127.0.0.1.

>   if (my ($ip) = $r->header_in('X-Forwarded-For') =~ /([^,\s]+)$/) {
>   $r->connection->remote_ip($ip);
>   }
>
>return OK;
>   }
>

--
Eric





Logging response times

2000-06-13 Thread Eric Jain

I currently log "time - $r->request_time" in my PerlLogHandler.

This seems to works well, but I'm sure there is a better method, which
also is able to log more detailed than just in seconds...



--
Eric Jain




Re: Apache children hanging

2000-06-13 Thread Eric Cholet

> Is there any equivalent procedure for debugging core
> dumps?  I've tried this and it doesn't work because
> the process is not running.  When I process dies it
> would be nice to know where it was in the Perl stack.

% gdb httpd core

> 
> -P
> 
> -Original Message-
> From: Doug MacEachern [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 01, 2000 6:27 PM
> To: John Armstrong
> Cc: Gustavo Duarte; [EMAIL PROTECTED]
> Subject: Re: Apache children hanging
> 
> 
> > % 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
> 
> 

--
Eric





RE: escaping the escaped chars (particularly %)

2000-06-09 Thread Eric Jain

Suddenly and mysteriously the problem disappears when I start doing
the URL rewriting  in my *PerlPostReadRequestHandler* instead of my
PerlTransHandler :-) Thank you anyways...


--
Eric Jain


> -Original Message-
> From: Tim Tompkins [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 10, 2000 12:42 AM
> To: Stas Bekman; [EMAIL PROTECTED]
> Cc: Eric Jain
> Subject: Re: escaping the escaped chars (particularly %)
>
>
> Is the %2B translation to a space the only problem?  It
> sounds to me as
> though the unescape sequence is reversed.  Plus signs
> should be unescaped to
> spaces before hex translations.  If this order is reversed, %2B will
> translate to a space.
> Check your unescape procedure and see what it's doing.
>
> I would also double check that you don't have a script or
> some other process
> attempting to unescape a previously unescaped string.
> Thanks,
>
> Tim Tompkins
> --
> Programmer / Staff Engineer
> http://www.arttoday.com/
>
>
> - Original Message -
> From: Stas Bekman <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: Eric Jain <[EMAIL PROTECTED]>
> Sent: Friday, June 09, 2000 3:09 PM
> Subject: escaping the escaped chars (particularly %)
>
>
> >
> >  Hmm, can please someone confirm this? I'm afraid there
> is an HTTP specs
> > violation here, and the server in question should be
> fixed not the code
> > that generates URLs... see below for more info.
> >
> > Thanks!
> >
> >  Original Message 
> > Subject: RE: mod_perl guide corrections.
> > Date: Fri, 9 Jun 2000 22:47:49 +0200
> > From: "Eric Jain" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> >
> > > -Original Message-
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, June 09, 2000 9:19 PM
> > > To: Eric Jain
> > > Subject: Re: mod_perl guide corrections.
> > >
> > >
> > > Eric Jain wrote:
> > > >
> > > > In
> > >
> http://thingy.kcilink.com/modperlguide/correct_headers/3_3_GET.html
> > > > :
> > > >
> > > > " Thus it allows the co-existence of queries from
> > > ordinary forms that
> > > > are being processed by a browser and predefined requests
> > > for the same
> > > > resource. It has one minor bug: Apache doesn't allow
> > > percent-escaped
> > > > slashes in such a query string. So instead of:
> > > >
> http://foo.com/query;BGCOLOR=blue;FGCOLOR=red;FONT=%2Ffont%2Fbla
> > > > you have to use:
> > > > http://foo.com/query;BGCOLOR=blue;FGCOLOR=red;FONT=/font/bla "
> > > >
> > > > I noticed that %2B (+) and %3F (?) wouldn't work when
> > > using this kind
> > > > of query strings, at least not on my websever. %2B would be
> > > > interpreted as a space, for example.
> > > >
> > > > Obviously the query string is being unescaped twice.
> > > >
> > > > One solution is to simply escape all the '%' (%25):
> > > >
> > > >
> > >
> http://foo.com/query;BGCOLOR=blue;FGCOLOR=red;FONT=%252Ffont%252Fbla
> > > >
> > > > It works :-)
> > >
> > > Eric, what you say is that one should escape only the %
> > > sign and there is
> > > no need to use the real charaacters like in the suggestion
> > > above? Am I right?
> >
> > Nearly :-) What I actually meant was the following:
> >
> > To build a proper Link:
> >
> > STEP 1: Escape all special characters, as usuall:
> > +biotech -t?s/t  ->  %2Bbiotech+-t%3Fs%2Ft&area
> >
> > STEP 2: Now escape a *second* time (ie replace all '%'
> with '%25'):
> > %2Bbiotech+-t%3Fs%2Ft&area  ->  %252Bbiotech%2520-t%253Fs%252Ft
> >
> > Voilà.
> >
> > Try
> http://biodoc.ch/de/articles;query=%252Bbiotech%2520-t%253Fs%252Ft
> > , and observe what appears in the query field...
> >
> >
> > > But you still have to process those to escape, so may be
> > > unless it's &<>
> > > chars you can just make them the real chars, instead of
> > > using the hex
> > > value as in a suggested solution to the problem?
> >
> > '?' doesn't seem to work either. Also their might be problems with
> > certain proxy servers when using strange characters? The above
> > solution should work in any case. Only drawback: It
> doesn't look that
> > nice :-)
> >
> > sub encode
> > {
> > $_ = shift;
> > s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg;
> > s/\%/\%25/g;
> > return $_;
> > }
> >
> >
> > --
> > Eric Jain
> >
>




RE: PerlTransHandler and CGI.pm

2000-06-07 Thread Eric Jain

Got it... Seems like the query string is decoded twice: Therefore

http://biodoc.ch/de/search;query=%252Btest+%252Bdna+-xyz

works perfectly, since all the '%' are encoded. Then it even works
with slashes :-)


--
Eric Jain


> When processing the url
> http://biodoc.ch/de/search?query=%2Btest+%2Bdna+-xyz ,
> $cgi->param('query') correctly returns '+test +dna -xyz'.
>
> But if I use http://biodoc.ch/de/search;query=%2Btest+%2Bdna+-xyz
> instead, I get ' test  dna -xyz'. If I include a %3F (=?)
> in the url,
> I even get a 404 error. Slashes too only work if they are
> not encoded.
>
> There must be something wrong in my PerlTransHandler, approximatly
> here:
>
>   my $uri = $r->uri();
>
>   if ( my($u1,$u2) = $uri =~ / ^ ([^?]+?) ; ([^?]*) $ /x )
>   {
>   $r->uri($u1);
>   $r->args($u2);
>   }
>
> But what?
>
> --
> Eric Jain
>




PerlTransHandler and CGI.pm

2000-06-07 Thread Eric Jain

When processing the url
http://biodoc.ch/de/search?query=%2Btest+%2Bdna+-xyz ,
$cgi->param('query') correctly returns '+test +dna -xyz'.

But if I use http://biodoc.ch/de/search;query=%2Btest+%2Bdna+-xyz
instead, I get ' test  dna -xyz'. If I include a %3F (=?) in the url,
I even get a 404 error. Slashes too only work if they are not encoded.

There must be something wrong in my PerlTransHandler, approximatly
here:

my $uri = $r->uri();

if ( my($u1,$u2) = $uri =~ / ^ ([^?]+?) ; ([^?]*) $ /x )
{
$r->uri($u1);
$r->args($u2);
}

But what?

--
Eric Jain




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: [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 Strovink

Eric Cholet wrote:

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





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: Vulnerability awareness

2000-06-07 Thread Eric Strovink

Gunther Birznieks wrote:



> >From: Jan Dubois <[EMAIL PROTECTED]>
> >I don't think so.  You should never let people execute arbitrary code on
> >your web server anyways.  If you do, then the potential intruder can do
> >much more nasty things than just snooping around in memory.
> >-Jan
> I think Jan is right to some degree. But he's also not necessarily thinking
> outside the box which is exactly what a hacker will do.



This reminds me of a discussion that has been conducted here before.  One could as
well ask, "Isn't embperl [or any other embedded code implementation] a security
risk?"  One camp says of course not, you should protect yourself against tainted
user data, etc., plus whatever other ways exist to trick the server into executing
a foreign Perl fragment, and it's your fault if you don't, so there's no risk.
Another camp says yes, if your server is *able* to execute embedded code of some
kind, then by enabling this capability you've added to the risk by definition --
and by the way, you can't claim to have thought of *all* the ways that someone
might trick you into running a code frag, because you're probably not thinking
about it as hard as they are.





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





[OT] "Tone" on this list

2000-05-26 Thread Eric Strovink

I've been lurking on this list for a long time, learning tons, implementing some 
things on
my own, helping out as I can (which isn't much).

I feel like I know all the frequent posters on the list by now.  It's funny how that
happens, but I can recognize each person's "tone," like a familiar co-worker.   I 
really
enjoy the friendly atmosphere, and how much help and information flows here.

Now and then, someone new posts, and sometimes s/he gets off on the wrong foot.  One
problem is the medium.  I know I've made the mistake in the past (hopefully not on this
list) of being too passionate in my phrasing, and it can be very easily misinterpreted,
smilies notwithstanding.

All in all, I'm proud of this list's tone.  As always, when a problem is laid before
others, it's necessary to work through the chaff in order to convince everyone that it
isn't some problem we've seen before, or some issue we've beaten to death.  Until we
establish some independent credibility here, we are likely to get a number of answers 
that
aren't correct, and maybe even a bunch of blow-off answers that are way off-base.   But
this list always gets to an answer eventually, and that's what's great about it.

I'm sorry that Marc Lehmann got some private answers that annoyed him.  As someone 
posted
recently, maybe one solution is to keep substantive dialogue on the list, and then we 
can
make sure not only that our discussion is moderated properly, but that others can share
the information.





RE: Cache control

2000-05-26 Thread Eric Jain

> The problem I have is that IE5 (and perhaps other browsers
> and versions)
> but NOT Netscape 4.x have absolutely no respect for cache-control.

IE5 can be set up to ignore any cache directives and keep a document
for either the duration of the session or forever. (Or reload it every
single time or check if it should be reloaded...)

This might be the cause of its respectlessness :-)


--
Eric Jain






Preloading modules

2000-05-25 Thread Eric Jain

Any Perl module required from within a module which has been preloaded
through PerlRequire or PerlModule in httpd.conf will be preloaded into
shared memory as well. Correct?


--
Eric Jain




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;
>
>
>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: Apache::DBI->connect_on_init in BEGIN?

2000-05-15 Thread Eric Cholet

> hi all,
> 
> what i'd like to do is "pre-initialize" my DBI connections from whithin
> my PerlHandler's BEGIN block. 
> 
> something like this:
> BEGIN {
>   if ( Apache->dir_config('CONNECT_ON_INIT') {
>   Apache::DBI->connect_on_init(Apache->dir_config('DBI_INFO');
>   }
> }
> 
> but of course the Apache* stuff isn't available at this stage...

you should be able to use Apache->server->dir_config('foo')
at this point. Doesn't work with per-vhost config variables, unfortunately.
Please do let me know if this works for you.

--
Eric




[OT] Re: 100% sessions?

2000-05-09 Thread Eric Strovink

Stas, this thread is very interesting.  Guide material?





Content negotiation headers

2000-05-07 Thread Eric Jain

How do I suppress content negotiation headers?

I am using my own handler to convert XML to HTML on the fly:

http://biodoc.ch/de/forum/2000/1/01.xml ->

HTTP/1.1 200 OK
Date: Sun, 07 May 2000 20:40:52 GMT
Server: Apache/1.3.9 (Unix)  (SuSE/Linux) mod_perl/1.21 mod_ssl/2.4.7
OpenSSL/0.9.4
Connection: close
Content-Type: text/html

Perfect, except that I would like to hide the file ending. Enter
mod_negotiotion:

http://biodoc.ch/de/forum/2000/1/01 ->

HTTP/1.1 200 OK
Date: Sun, 07 May 2000 20:40:21 GMT
Server: Apache/1.3.9 (Unix)  (SuSE/Linux) mod_perl/1.21 mod_ssl/2.4.7
OpenSSL/0.9.4
Content-Location: 01.xml
Vary: negotiate
TCN: choice
Connection: close
Content-Type: text/html

This will obviously not be cached by any proxies :-(

So how do I get rid of Content-Location, Vary and TCN?


--Eric Jain




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:
> 
> 
> push @ScriptAlias, "/cgi-benedict/", "/users/benedict/cgi-bin/"  ;
> 

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:
> 
> 
> my $cgi_users = qw(xx yy);
> for ($cgi_users) {
>   push @ScriptAlias, "/cgi-$_", "/users/$_/cgi-bin";
> }
> 
> 
> 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: ", destho

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: mod_perl 2.x/perl 5.6.x ?

2000-04-22 Thread Eric Cholet

> I'm more of a perl end user and plead ignorance in actually understanding
> what goes on behind the scenes. In the process of considering upgrading to
> perl 5.6 and according to a recent message I see its going to be required
> for mod_perl 2.x anyways so I guess its a good time to start migrating in that
> direction. I was curious as to if there are requirements as to how perl
> should be built for this. I scanned through the archives as I seemed to
> remember some threads about this awhile ago, especially regarding threads
> and multiplicity, from what I can see it looks like -DMULTIPLICITY is
> going to be required ?, don't know about -DTHREADS, doesn't look like it
> though. Can anybody in the know, shed some light on this, just trying to
> save some work down the road as I'd like to upgrade to the perl 5.6 stuff
> now and use it with my existing mod_perl (I already use the CVS version
> and I know thats required for perl 5.6) but I really don't want to have
> recompile perl (and modules, etc) again later if I can build it the way
> it will need to be now and continue using mod_perl 1.x and then just upgrade
> to mod_perl 2.x down the road.

mod_perl-2.0 requires perl 5.6 to be build with -Dusethreads, which turns
on threading and multiplicity. The biggest hurdle I've faced until now is
that DBI won't build with this threaded perl. Hopefully DBI will be updated
since the latest version is from july 99.
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 :-)

--
Eric






Re: apache 2.0 port?

2000-04-19 Thread Eric Cholet

On Wed, Apr 19, 2000 at 02:26:22PM -0700, Brian Martin wrote:
> Hey everybody,
> 
> I was just wondering if there is anyone working on porting mod_perl to
> apache 2.0.  I couldn't seem to find any mention of this on the web page
> or list archives.
> 
> If noone else is working on this I'm willing to take a crack at it.
> 
> Brian

Doug is busy writing mod_perl 2.0 which works with perl 5.6 and
Apache 2.0. It's available from CVS at
http://perl.apache.org/from-cvs/modperl-2.0/
You can't do much with it yet but Doug is moving pretty fast.

-- 
Eric Cholet



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: [RFC] Do Not Run Everything on One mod_perl Server

2000-04-18 Thread Eric L. Brine


It used to be one process for everything, or at least one application for
everything.  Then mod_perl comes in and people have started using a tiered
system (plain server + mod_perl server). Now you're talking about
individual application servers. Someday, maybe the script will load the
server instead of the other way around!

  use mod_perl (8080, 3);  #  (port, #processes)

Sorry, feeling philosophical this morning. Thanks for the report.
ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



RE: Apache::RegistryLoader side effect

2000-04-13 Thread Eric Hastings



I 
preload Apache::Registry, replacing RegistryLoader, and it works 
indentically.  Interesting.  Can you point me to where in the archives 
this is doc'ed?  I searched using Apache::RegistryLoader, but didn't find 
this specifically.  I'd like to learn what I can about 
it.
 
And 
I'll check out the current version.  Thanks for the 
tip!
 
E

  -Original Message-From: Geoffrey Young 
  [mailto:[EMAIL PROTECTED]]Sent: Thursday, April 13, 2000 1:43 
  PMTo: 'Eric Hastings'; '[EMAIL PROTECTED]'Subject: RE: 
  Apache::RegistryLoader side effect
  this problem with Apache::Registry is well documented 
  in the archives - I really didn't test it to see if it affected RegistryLoader 
  as well, but it sounds the same...
   
  try using the current cvs version - it should 
  have the problem licked.  If you don't want to use a development version, 
  try preloading Apache::Registry along with RegistryLoader and see if the 
  problem disappears...
   
  HTH
   
  --Geoff
  
-Original Message-From: Eric Hastings 
[mailto:[EMAIL PROTECTED]]Sent: Thursday, April 13, 2000 
1:18 PMTo: '[EMAIL PROTECTED]'Subject: 
Apache::RegistryLoader side effect
I have a 
plain-old CGI script configured to be loaded with 
Apache::Registry
 
myscript.pl>SetHandler  
perl-scriptPerlHandler Apache::RegistryOptions 
ExecCGIPerlSendHeader On
In this 
configuration, I see the BEGIN block of my script get executed twice per 
child process. If I add the line "PerlModule Apache::RegistryLoader" to the 
httpd.conf file, this gets cut down to once per child process (which is what 
I want!)  Is this behavior documented anywhere?  I have been 
scouring Doub's book and other online resources for 2 days, and don't 
understand this behavior.
 
(An aside:  
All the docs talk about using 
"Apache::RegistryLoader->new->handler(...)", and that works to make 
BEGIN execute only once (I even tried it myself to be sure).  But 
nothing about using RegistryLoader the way I am.  Am I doing 
something horribly wrong?)
 
Thanks.
E
 
 


Apache::RegistryLoader side effect

2000-04-13 Thread Eric Hastings



I have a plain-old 
CGI script configured to be loaded with Apache::Registry
 
myscript.pl>SetHandler  
perl-scriptPerlHandler Apache::RegistryOptions ExecCGIPerlSendHeader 
On
In this 
configuration, I see the BEGIN block of my script get executed twice per child 
process. If I add the line "PerlModule Apache::RegistryLoader" to the httpd.conf 
file, this gets cut down to once per child process (which is what I want!)  
Is this behavior documented anywhere?  I have been scouring Doub's book and 
other online resources for 2 days, and don't understand this 
behavior.
 
(An aside:  All 
the docs talk about using "Apache::RegistryLoader->new->handler(...)", and 
that works to make BEGIN execute only once (I even tried it myself to be 
sure).  But nothing about using RegistryLoader the way I am.  Am 
I doing something horribly wrong?)
 
Thanks.
E
 
 


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





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




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 this
> site or from href="http://www.cpan.org/ CPAN  <-- HERE
> 
>
> 
> 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: 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 2>&1 |")) {
print while ;
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: Silly Question

2000-04-07 Thread Eric L. Brine


> I want to know if the script can be set with setuid as root for
> execution.

Since you asked this on this list, I will assume the script is a mod_perl
script.  Unless the whole web server runs as root, I don't think the
script can run as root.

Here's what you can do instead. Have the mod_perl script add the info
needed to a to-do list. Setup a root cron job to periodically check if
there is anything in the to-do list. If there is, process the entry. Of
course, that means the changes don't take effect immidiately.

Another alternative is to run the script as a .cgi instead of as a
mod_perl script. CGI scripts can run as root without running the server as
root.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: THREE STRIKES...

2000-04-07 Thread Eric L. Brine


Why not track IP instead of user name in failed attempts? e.g. Lock out IP
www.xxx.yyy.zzz for an hour if it makes 6 successive bad attempts?

I realize the attacker could change his IP, but that takes time.

I realize that two people can share an IP (e.g. proxy users), it opens for
the possibility of locking out a legitmiate user by an attacker (DoS) if
they are on the same proxy, but that might be acceptable. I also set the
count a bit higher ('6' instead of '3') to compensate for multiple users
trying to login from the same proxy.

Of course, adding a "sleep(5)" before returning a message saying the
attack failed would help too.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



RE: PerlTransHandler and 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 :
> 
>  
>PerlTransHandler  Apache::MyHandler
>  
> 
> 
> 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: [OT][General Programming] Key Generator sub

2000-04-07 Thread Eric Cholet

> ok, what I'm looking for is a poor man's crypt(). And a simple one,
> because whatever logic I use, I must reproduce in a limited proprietary
> language (Macromedia Director's "Lingo"). Lingo won't allow me to do bit
> math, 'xor' nor any sophisticated scheme. Plain math stuff and string
> manipulation.

If I needed that I'd write an Xtra with a standard C implementation of crypt.
Isn't that how you do things with Director, if you can't write it in Lingo
then write an Xtra in C. Well that's how we do it here.

--
Eric




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




Apache::ASP and MySQL strange behavior

2000-02-06 Thread Eric B

I have been using eperl until recently, but found Apache::ASP provides
useful session features that I like.  Also, I am experienced with ASP.  I
installed Apache::ASP and it seems to operate quite nicely most of the time.

However, there is some odd caching or some kind of saving going on because I
get the error "MySQL server has gone away" (in the error_log of that site).
My dbh routines are contained in a file subs.pl which I require "subs.pl"
from the main script, manage.phtml.  If I don't use subs and include files I
will working on this until I'm about a billion years old.

I realized this could be due to connections not closed properly, so I
changed my script to call the sub that performs explicitly $dbh->disconnect.
Nope, this did not solve the problem.

I then tried to put undef($dbh) after the disconnect, and got this error on
the script the next time it was run:
"cannot call method prepare on an undefined value".  Which basically means
that it thinks that $dbh is not defined although I define it in my file
"subs.pl".  Like I said, there is some very wierd type of scripting going
on, whereas certain scripts appear to remain memory resident or are not
recompiled.  I don't know.  And this is even with StatINC=1.

My httpd.conf directives are

AddHandler perl-script .phtml
PerlHandler Apache::ASP
PerlSetVar Global /tmp/asp # (yes, the directory exists and is chmod 777)
PerlSetVar GlobalPackage main # I need for access to "global" variables
PerlSetVar Debug 2
PerlSetVar StatINC 1 # this helped a little bit!


I think this is a mod_perl/Apache::ASP problem becase It works just fine
under eperl.
I temporarily went back to eperl since the client wants to see this working
by tomorrow, I will use the Apache::Session module.
But that really sucks.  I would like to get this thing working.

Thanks



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: 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,
> > >
> > >
> > >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]
> > >
> > >
> > >thanks,
> > >
> > >josh
> > >
> > >
> > >--
> > >josh rotenberg
> > > [EMAIL PROTECTED]
> > > www.parasite.com
> > 
> > -
> > Kenneth Frankel
> > [EMAIL PROTECTED]
> 
> -- 
> josh rotenberg
>   [EMAIL PROTECTED] 
>   www.parasite.com
> 




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:
> 
>   
>   require Apache::TestDirective;
>   delete $INC{'Apache/TestDirective.pm'};
>   
>   #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: modperl success story

2000-01-14 Thread Eric Strovink

The troll vanisheth!

   - Transcript of session follows -
... while talking to mc5.law5.hotmail.com.:
>>> RCPT To:<[EMAIL PROTECTED]>
<<< 550 Requested action not taken:user account inactive
550 <[EMAIL PROTECTED]>... User unknown




RE: Cryptic errors -simple Apache::Registry script ??? (newbie)

2000-01-10 Thread Eric Cholet

> 
> Syntax error on line 941 of /usr/local/apache/conf/httpd.conf:
>  cannot occur within  section
> ../src/support/apachectl start: httpd could not be started
> 
> Here is the (only) difference between the failing config and the one
> currently on the live server.  This is in a  section:
> 
> 940,943c940,945
> <   
> < SetHandler  perl-script
> < PerlHandler Apache::Footer
> <   
> ---
> >   
> > 
> >   SetHandler  perl-script
> >   PerlHandler Apache::Footer
> > 
> >   
> 
> What seems to have confused me was that to repair the config I removed
> the  directive.  Sorry if this confused anyone else.

You can't have a FilesMatch section inside a Location section, it's
a contradiction. See http://www.apache.org/docs/mod/directive-dict.html#Context

--
Eric



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: Cryptic errors -simple Apache::Registry script ??? (newbie)

2000-01-10 Thread Eric Cholet

> 
> Hi there,
> 
> On Sun, 9 Jan 2000, John Walker wrote:
> 
> > This is in a virtual host section, could that be a problem?
> 
> Apache 1.3.9 (with mod_perl 1.21/perl5.005_03) doesn't let me use a
>  section in a  section.

Really? That's quite odd. What is the error message?

--
Eric



RE: Logging cookie authentified user as regular authentified users

2000-01-10 Thread Eric Cholet

> ... exccept taht will give you the authenticated user name, as in, the name
> entered at the Authentication phase. 

When I said: $r->connection->user($user), I meant you can use this to _set_
the user, regardless of whether you used an auth handler or not.
Sorry for being unclear.

$r->connection->user('CHOLET');
 
> When Nicholas says the authentication
> is handled at the "script level", I assume that he means that it is handled
> during the content generation phase. I would write a separate module or 
> registry script and put that in place as a PerlAuthenHandler. All it has to
> do is return AUTH_REQUIRED to deny access, OK to allow access, based on
> whatever means you are using (cookies are available at this point, you just
> can't send HTML to the browser), or DECLINED to let Apache or another custom
> module handle it.
> 
> After this point, yes, $r->connection->user will give you the username that
> was entered, and ($r->get_basic_auth_pw)[1] will return the password that 
> was entered.
> 
> darren
> 
> Eric ([EMAIL PROTECTED]) wrote:
> > On Fri, Jan 07, 2000 at 10:59:10AM +0100, Nicolas MONNET wrote:
> > > 
> > > I am using a cookie based authentification mechanism, the authentification
> > > is handled at the script (Apache::Registry) level. Is there a way to pass
> > > the info to logging mechanism so that I can have my "user" value passed as
> > > if it was transmitted to Apache as an HTTP authentification?
> > 
> > Yes: $r->connection->user($user);
> > 
> > > 
> > > -- 
> > > Nicolas MONNET, Technical Director, IT-Xchange
> > 
> > -- 
> > Eric Cholet
> 
> -- 
> If all the world is a stage, where is the audience sitting?

--
Eric CHOLET



Re: Perl modules in apache configuration

2000-01-09 Thread Eric

On Sun, Jan 09, 2000 at 08:47:04PM +0300, [EMAIL PROTECTED] wrote:
> Hello!
> 
> I'm trying to configure httpd.conf using Perl sections (mod_macro is
> not enough for me), but the result is weird. 
> 
> The most weird thing is that Perl sections randomly doesn't execute! I
> have no experience (yet) with Perl configuration modules, so I don't
> understand where to start tracking.
> 
> mod_perl developers' guide didn't help, as perldoc mod_perl :-(

Do you have a specific example of your config, and what doesn't work,
that you could post maybe? It's hard to help without specifics.

-- 
Eric Cholet



Re: cannot open a file....

2000-01-08 Thread Eric L. Brine


> $file_to_name = "/cgi-bin/passwd~1"; #Name the file
> open(file_handler,$file_to_name); #Open the file
> @lines_to_read = ; #Read it into an array
> close(file_handler);   #Close the file
> print @lines_to_read;  #Print the array

There is no file called "/cgi-bin/passwd~1"; use the full path.
Alternatively, a relative path could be used (e.g. "passwd~1"). A second
alternative is to set a var in the .conf files specifying the name of the
password file.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: Logging cookie authentified user as regular authentified users

2000-01-08 Thread Eric

On Fri, Jan 07, 2000 at 10:59:10AM +0100, Nicolas MONNET wrote:
> 
> I am using a cookie based authentification mechanism, the authentification
> is handled at the script (Apache::Registry) level. Is there a way to pass
> the info to logging mechanism so that I can have my "user" value passed as
> if it was transmitted to Apache as an HTTP authentification?

Yes: $r->connection->user($user);

> 
> -- 
> Nicolas MONNET, Technical Director, IT-Xchange

-- 
Eric Cholet



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: CGI and forms (GET vs Post)

2000-01-06 Thread Eric L. Brine


> I read on w3 that they suggest 'post' for when there are no
> visible changes, and 'get' when there are (or perhaps the other way
> around).  This seems a bit confusing.  What is the difference in 
> laymen's terms?

Other way around.

GET is to be used when there is no side effect.
  e.g. when submitting a search query, when asking for one's bank balance
  or otherwise fetching info. The browser uses the GET method to fetch
  HTML docs, images, and everything else except forms which specify a
  different method.

POST is to be used when there is a side effect.
  e.g. when updating one's billing address at an online store, when
  telling the server to transfer funds or whenever this tells the server
  to do something besides fetching info.

The difference lies in how the browsers treat expired data. A browser
will happily do the same GET multiple times if the user requests an 
expired page. If a page fetched with the POST method expires, the
browser will(/should) ask the user if he wants to resubmit the info
which would result in the transaction being repeated.

e.g. If the script transfers funds, you don't want to browser to 
accidently ask for the funds to be transfered twice, so you would
use the POST method.

e.g. If the script shows which movies are playing in the specified
town, the GET method should be used because it's not a problem if
the browser needs to refresh itself by asking the server for the
info a second time.

In doubt, use POST. Some people also use POST because it doesn't
clutter the requested URL, but that is not the intended reason to
use POST.

>  Also, could the problems I'm seeing when I test the script be a
> caching issue?

Yes, it could be (as far as I can tell from your description).
Try telling the browser not the cache the cancel page.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: Storing hashes in Apache::ASP

2000-01-06 Thread Eric L. Brine

> Er, I beg to differ. \%hash returns a reference to that hash -
> see the top of p.246 of the camel book, 2nd ed.
> The {} operators are for creating *anonymous* hashes.

I stand corrected. I was thinking of \($a, $b, $c).  I always thought
\@array and \%hash worked the same way, so I never used them.

Sorry,
ELB

test.pl
===
%hash = (a => '1', b => '2', c => '3');
@array = qw(a b c);

@array_ref = \@array;  # returns ref to array
@hash_ref = \%hash;# returns ref to hash
@list_ref = \(@array); # returns ref for each element

{
  local $, = ', ';
  local $\ = "\n";
  print(@array_ref);   # prints: ARRAY(0x655b78)
  print(@hash_ref);# prints: HASH(0x655af4)
  print(@list_ref);# prints:
  # SCALAR(0x6559bc), SCALAR(0x6559d4), SCALAR(0x6559ec)
}


--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: Storing hashes in Apache::ASP

2000-01-06 Thread Eric L. Brine



> How about using a hashref
> $stuff = { a => '1', b => '2', c => '3' };
> $Session->{Stuff} = $stuff;
> instead of a hash?

According to the other person, that would fix your problem.
Personally, I know too litte of EmbPerl to be of more help.

btw,
  $Session->{Stuff}{$i}
is the same as
  $Session->{Stuff}->{$i}
so you were already expecting a hashref. I think perllol is the relevant
man page, and you might also want to review perlref.

ELB


Original Problem:
> I've been trying to store a hash in a session variable, using
> code like that appended below.  Call me a doofus, but I can't
> seem to get it to work.  Can anybody tell me what I'm doing wrong?
>
> Example follows:
> 
> <%
> %stuff = ( a => '1', b => '2', c => '3' );
>
> $Session->{Stuff} = %stuff;
>
> $Response->Write ( "Results --\n" );
> for $i (keys %{$Session->{Stuff}} ) {
> $Response->Write ( "$i: $Session->{Stuff}{$i}\n" );
> }
>
> %>
> 

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: Storing hashes in Apache::ASP

2000-01-06 Thread Eric L. Brine

> You have to store a reference to the hash, ie
> 
> $Session->{Stuff} = \%stuff;
> not
> $Session->{Stuff} = %stuff;


\%stuff is not a reference to a hash, it's a reference to each key and
value in the hash. I don't think you'll ever have to use \ on arrays or
hashes. The only way to get a hash ref is by using the {} operator. e.g.:
{%stuff}  Of course, you know how two copies of the data, so be careful.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: Modperl module.

2000-01-05 Thread Eric L. Brine


> I am looking for a ModPerl-module that gives me similar functionality as
> Zope (written in Python and C) an application server.
> Especially being able to modify/build a site stored in a database
> through a webb interface.

> Yes, I have looked at CPAN and the Apache/Perl Module List, but was
> not able to find anything similar to Zope there.

It sounds more like an application than a package, therefore it
wouldn't/shouldn't be on CPAN. Check freshmeat. If not, there could/should
be such a project in progress in the Source Garden.

http://www.freshmeat.net/
http://modperl.sourcegarden.org/

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: "can't open stdout"--a problem about CGI

2000-01-03 Thread Eric L. Brine


> I think the script can't open STDOUT in a child process under
> CGI, a simpler statment: system("ls") didn't work too, until
> I chanaged it to: print `ls`;

See http://perl.apache.org/guide/porting.html#Output_from_system_calls

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: installing ApacheDBI..

2000-01-01 Thread Eric L. Brine


Apache::module() is defined in Apache.xs. I'm (wild) guessing you are not
running under mod_perl or you have a broken install.

http://perl.apache.org/guide/install.html#How_can_I_tell_whether_mod_perl_
answers: "How can I tell whether mod_perl is running?".

ELB

 snippet from Apache.xs 
I32
module(sv, name)
SV *sv
SV *name

CODE:
if((*(SvEND(name) - 2) == '.') && (*(SvEND(name) - 1) == 'c'))
RETVAL = find_linked_module(SvPVX(name)) ? 1 : 0;
else
RETVAL = (sv && perl_module_is_loaded(SvPVX(name)));

OUTPUT:
    RETVAL


--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: PerlRun and Exporter() vars

1999-12-29 Thread Eric L. Brine

> exported variables from  modules lose their value after the first run. 
> This appears similar to an old post

> package test2;
> [...]
> BEGIN {
> #   use vars qw($TEST);
> use Exporter ();
> @test2::ISA = qw(Exporter);
> @test2::EXPORT = qw();
> @test2::EXPORT_OK = qw($TEST &runit);
> }
> [...]

Under mod_perl, BEGIN blocks only get executed once per child.
Therefore, the variables are only exported in the first run.
Just move the content of the BEGIN block outside of the block
as follows:

package test2;
[...]
# use vars qw($TEST);
use Exporter ();
@test2::ISA = qw(Exporter);
@test2::EXPORT = qw();
@test2::EXPORT_OK = qw($TEST &runit);
[...]

or:

package test2;
[...]
{
#   use vars qw($TEST);
use Exporter ();
@test2::ISA = qw(Exporter);
@test2::EXPORT = qw();
@test2::EXPORT_OK = qw($TEST &runit);
}
[...]


> Is this [...] A bug?

no. This problem is not related to PerlRun or the flushing of the name
space; the problem would also occur if one tried to use the module from
two different scipts/modules (in the same child). 

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: [Embperl] Bareword not allowed !

1999-12-22 Thread Eric L. Brine


> When it finds a statement looking like
>   HTML::Embperl::DOC::someSub;
> it will die, saying that barewords are not allowed when the
> strict pragma is in use.

That's what strict does. This same behavior is observed under straight
perl (i.e. without using mod_perl or Embperl).

{
  no strict;
  sub;# ok   # same as sub(@_);
  ⊂   # ok   # same as sub(@_);
  sub();  # ok
  &sub(); # ok   # same as sub();
}

{
  use strict;
  sub;# not ok   # same as sub(@_);
  ⊂   # ok   # same as sub(@_);
  sub();  # ok
  &sub(); # ok   # same as sub();
}

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: mod_perl and module versions

1999-12-22 Thread Eric L. Brine


> Lets say I have two directories :
> /cgi-bin/dir1 i  /cgi-bin/dir2
> and in every of them I have module conf.pm (configuration module).
> Of course the first using one of the module causes cache'ying
> it by mod_perl (using Apache::Registry or Apache::PerlRun).
> When I use 'use conf' from the other dir it sees the first included
> by perl_mod conf module (because it is present in global %INC)

I'm not familiar with the guts of Apache::Registry, so the following are
just things to try.

Possible solution 1
===
Try using a path when 'using' the file:
- BEGIN { require '/foo/bar/dir1/conf.pm'; }
- BEGIN { require '/foo/bar/dir2/conf.pm'; }
(also call import() if it exists.)

Possible solution 2
===
Unload the module before loading it by clearing the appropriate %INC and
by clearing the namespace. PerlRun has a function with clears the
namespace which one can use even if it's not a PerlRun script.

Possible solution 3
===
Instead of use() or require(), use do(). mod_perl won't cache it. This
may require modifications and you can't polute the namespace unless you
undo the changes before existing.

If conf.pm simply returns configurations values, it could be rewritten
like:
# conf.pl
my $sub = sub { return 'bla'; }; # doesn't pollute namespace
{
  a => 'foo',
  b => 'bar',
  c => &$sub(),
};

# main.pm
    my $config = do('conf.pl');


Take your pick!
ELB

> BTW Merry X-mas and happy Y2K ;o)
At least you didn't say millenium :-)

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: ASP.pm and Date::Manip/DBD::Sybase

1999-12-20 Thread Eric L. Brine


> I am having recurring troubles using the Date::Manip and DBD::Sybase
> modules in the contest of mod_perl/ASP pages. 75%-90% of the time my 
> ASP pages will work just fine.  The reminder 25-10% I get these kinds 
> of errors:

These both seem to be problems with the environment. Isn't there a
directive that sets environment variables? You might find a solution if
you have a look at (or use) that directive.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: Holding files open and locking

1999-12-19 Thread Eric L. Brine


> In a Registry script I open a file the first request and set a global
> variable flag.  Then for each request I just flock( FH, LOCK_SH ) and
> flock( FH, LOCK_UN).
> 
> The only problem I see is that if the lock isn't released I need to do 
> a graceful restart to get rid of that lock.  (But that would require a 
> bug in my program and I haven't put any in, yet.)

How about:
  sub cleanup {
flock(FH, LOCK_UN);
  }

  $SIG{__DIE__} = sub { 
cleanup();
die($_[0]);
  };

  END { cleanup(); }

> If I open a file once and do many many LOCK_SH without LOCK_UN I don't
> think I'll be leaking, as it's on the same file handle.  Is this a 
> correct assumption?

You'll never been able to write to the file if you don't unlock a shared
lock.

You'll never been able to read from or write to the file if you don't
unlock an exclusive lock.

> A reason I don't do a LOCK_EX in the Registry script is that if I leak 
> a LOCK_EX lock then everything shuts down.

The above snippet should fix that, I think. Simple tests can verify if
it works or not.

> Plus those requests are served so much faster if I don't waste time 
> locking ;)

I don't see file locking taking up any mentionable amount of time,
unless the file is already locked. If the file is already locked and you
ignore the lock, it defies the the whole purpose of locking them in the
first place.

> Anyway, just looking for ideas.

Have you considered logging to a database?

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: open 2 question

1999-12-19 Thread Eric L. Brine


> i am trying to get my mind around the concept of open2 which is..
> open2( /*MYSTDIN, /*MYSTDOUT, "myprog");

> how do i simply read to the program and write to the program..
> is it just...
> print MYSTDIN, "my data\n";
> and then a ..
> while() {
>   ...
> }

I think you will need to use the select(RBITS,WBITS,EBITS,TIMEOUT)
function (see perlfunc) or its OO equivalent, IO::Select.

ELB

PS - This does not belong on the mod_perl list.
Try somewhere else next time, such as comp.sys.lang.perl.

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: Summary Re: KeepAlive and mod_perl

1999-12-18 Thread Eric L. Brine

> GET / HTTP/1.0
> Connection: keep-alive
> 
> ==> doesn't work!

It worked for me!

> GET /perl/test.pl HTTP/1.0
> Connection: keep-alive
> 
> ==> doesn't work!

Couldn't test since I don't have/know a mod_perl server, but I suspect
it works because the previous test case worked for me.

> HEAD / HTTP/1.0
> Connection: keep-alive
> 
> ==> works!

> GET / HTTP/1.1
> Host: localhost
> 
> ==> works!

> GET /perl/test.pl HTTP/1.1
> Host: localhost
> 
> ==> works!

> I use Apache/1.3.10-dev (Unix) mod_perl/1.21_01-dev
I used www.unb.ca:80, running Apache/1.3.4 (no mod_perl)

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: Apache::Registry VS CGI deamon

1999-12-18 Thread Eric L. Brine


> It is my understanding that Apache::Registry allows me to run CGI 
> scripts with out any modifications. Using this approach, Apache will 
> load the script into memory at startup. Whenever there is a request 
> for that script, it is already loaded and is executed on the fly with
> out the need to compile the code. Great!

If you use less than 'strict' coding practices, your CGI script may
exhibit problems if run as an Apache::Registry script with no
modifications. I believe Apache::PerlRun is closer to what you describe.

Refer to the guide: http://perl.apache.org/guide/
and specifically:   http://perl.apache.org/guide/porting.html

> Is it also my understanding that a CGI script can be run as a deamon. 
> Also, the script is loaded into memory and, if a request comes in, 
> there is not need to compile the code since the script is already 
> running.

There are products which do this, like Velocigen's (for example). These
solutions may or may not be free and they do not have mod_perl's
flexibilty if you ever want to do more than Apache::Registry scripts. I
don't know about performance, but I can't see them being any faster.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



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: Killing a child process

1999-12-17 Thread Eric L. Brine

>  my $pid = open( PROG, "-|" );
>  if ($pid) {
>  while () {
>  [..]
>  }
>  }
>  close( PROG ) or log_message( "failed close on program $! $?");
>
> I keep getting SIGPIPE errors ($? = 13) returned if I
> close before PROG is finished.

Maybe a reaper is needed here?  From perlipc:

sub REAPER {
$waitedpid = wait;
# loathe sysV: it makes us not only reinstate
# the handler, but place it after the wait
$SIG{CHLD} = \&REAPER;
}
$SIG{CHLD} = \&REAPER;
# now do something that forks...

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



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: Limiting CPU (was Re: embperl pages and braindead sucking robots)

1999-12-16 Thread Eric L. Brine


Randal> Yes, it's possible to configure it so that it works correctly, 
Randal> but if I recall, I also saw it fetch /cgi/whatever, even though 
Randal> that was in /robots.txt.  I *must* block anything that doesn't 
Randal> respect /robots.txt.  Once they fix that, I might let it loose.

Teleport Pro obeys robots.txt by default, but unfortunately, it can be
set to ignore robot exclusion rules. 

Michael> Just because one user configures the program to be
Michael> evil doesn't mean you should stop other people who
Michael> are trying to play nice.

Yes, it does. The actions of wrong dooers affect the innocent, here and
everywhere.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: 'var' instead of var ... (getting crazy)

1999-12-15 Thread Eric L. Brine


> the [query_string (url_params)] usually reads this query_string in 
> correctly, like this:
> record=32&lang=it
> BUT, SOMETIMES (random?) query_string is read
> like:
> 'record=32&lang=it'
> Where could my error be?

Do you have any mod_perl handlers that work at an earlier phase of the
request? Maybe they add the quotes by accident. Is the requested proxied
from a front-end or is mod_rewrite used? The quotes may be introduced
there by accident.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



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: all protected but one...

1999-12-15 Thread Eric L. Brine

> What is the best way to have a Location directive apply to an entire
> site except for a single directory?

Set the site-wide handler in a  and override the handler
for the "register" dir by setting the default handler in .  Unfortuntaly, I don't know the name of the default
handler.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



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:
> 
> 
>SetHandler perl-script
>PerlAccessHandler My::Access
> 

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: Limiting CPU (was Re: embperl pages and braindead sucking robots)

1999-12-14 Thread Eric L. Brine


> It's also been very successful at catching a whole slew of user-agents
> that believe in sucking senselessly.  Here's my current block-list:
> 
> [...]
> or m{Teleport Pro}  # bad robot!
> [...]

Teleport Pro does have options to control how it behaves:

1. "Obey the Robot Exclusion Standard". Default: On

2. "Wait  seconds before requesting more than two files at once from
a single server".  Valid: 0+  Default: 1 second

3. Number of threads. Valid: 1-10  Default: 10

Because of #2, Teleport Pro only has one active thread at a time, and it
is idle at least 50% of the time (when downloading image archives). In
other words, it's possible for a user can configure Teleport Pro to
hammer a server, but it behaves respectfully using the default settings.

Their site: http://www.tenmax.com/

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: Win32+modperl+EmbPerl - some questions ...

1999-12-13 Thread Eric L. Brine

> 'use HTML::Embperl' ( startup.pl) both don't work!
> Is this a special "Win32-behaviour"?

I might be wrong, but I thought Embperl should never be loaded in startup.pl,
even in UNIX.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



Re: piggybacking data on request ?

1999-12-12 Thread Eric L. Brine


> I am looking for way to pass data (e.g. hash reference)
> from one handler (e.g. from URI Translation to Response).

If the data is request-specific, look into $r->notes() and $r->pnotes().
I don't know what the difference is, but at least one of them does what
you want.

ELB

--
Eric L. Brine  |  Chicken: The egg's way of making more eggs.
[EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
ICQ# 4629314   |  An optimist thinks thorn bushes have roses.



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



<    1   2   3   4   >