RE: Strange delays

2000-07-04 Thread Eric Jain

> Once in a while the first page being requested by a client
> is delayed
> by approximately 10s, even though there is no significant
> load on the
> server. Usual delays are between 0 and 1s, rarely up to 4s (complex
> database queries).
>
> Any Ideas where to look for the cause of this?
>
> I first thought the problem might be with the database connections.
> However these same delays also happen with pages, that don't need to
> connect at all...

Turning off HostnameLookups solved the problem.


--
Eric Jain




Strange delays

2000-07-03 Thread Eric Jain

Once in a while the first page being requested by a client is delayed
by approximately 10s, even though there is no significant load on the
server. Usual delays are between 0 and 1s, rarely up to 4s (complex
database queries).

Any Ideas where to look for the cause of this?

I first thought the problem might be with the database connections.
However these same delays also happen with pages, that don't need to
connect at all...


--
Eric Jain



httpd.conf
--

...
Timeout  300
KeepAliveOn
MaxKeepAliveRequests 100
KeepAliveTimeout 5
MinSpareServers  10
MaxSpareServers  20
StartServers 10
MaxClients   30
MaxRequestsPerChild  1000
...


startup.pl
--

use strict;

use Apache::GTopLimit;
$Apache::GTopLimit::MAX_PROCESS_SIZE = 15000;

require BioDoc::Page;
require BioDoc::SQL;

use DBI ();
DBI->install_driver("Pg");

use CGI ();
CGI->compile(':standard');

1;




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




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




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