Re: [Mason] ANNOUNCE: Mason 1.15

2002-10-14 Thread Oleg Bartunov

On Mon, 14 Oct 2002, Dave Rolsky wrote:


 Eventually, we'll fork the code base again and start breaking things in
 preparation for an eventual 1.20 (or maybe some other version number cause
 we might get to 1.20 just by small bugfix/doc/performance releases), which
 will incorporate new features such as .NET compliance, full support for
 _all_ XML specs, and a special NP-problem solving module, plus a brand
 new set of ginsu knives.


Dave, just interesting. What does ginsu knives means :?



Regards,
Oleg
_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




Re: open-source suggestion for a knowledge-base/search engine?

2001-11-12 Thread Oleg Bartunov

If you may use PostgreSQL as a database engine,
there is an OpenFTS (openfts.sourceforge.net).
I'm one of the author, so I'm biased a little bit,
but we have successfully use it in many projects with
close integration with mod_perl (Mason).

regards,

Oleg
On Mon, 12 Nov 2001, Grant Babb wrote:


 all-
 
  In our migration to open-source solutions, I have been asked to
  suggest a solution for our knowledge base.  We have found that a
  well-indexed text search is really a more effective way to go, but I was
  hoping for some suggestions from this list on some mod_perl based
  projects or apache modules that might do the the trick.  PHP is OK too i
  guess, but when it comes to both fast lookups and text manipulation,
  mod_perl/mySQL seemed like the obvious way to go.
 
 thanks in advance for the input,
 grant
 
 Grant Babb  Email: [EMAIL PROTECTED]
 Data Junction Corporation   Phone: (512) 459-1308
 2201 Northland Dr.  Fax: (512) 459-1309
 Austin, TX 78756-1117   Web: http://www.datajunction.com
 

 Grant Babb  Email: [EMAIL PROTECTED]
 Data Junction Corporation   Phone: (512) 459-1308
 2201 Northland Dr.  Fax: (512) 459-1309
 Austin, TX 78756-1117   Web: http://www.datajunction.com




Regards,
Oleg
_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




RE: [OT] pdf creation

2001-10-29 Thread Oleg Bartunov

Matt,

do you have a plan to release PDFLib.pm ?

Oleg
On Mon, 29 Oct 2001, Matt Sergeant wrote:

  -Original Message-
  From: Lon Koenig [mailto:[EMAIL PROTECTED]]
 
  I apologize for the OT post, but the members of this list seem to be
  authoritive resource for all web/perl solutions.
 
  I'm currently bidding a project, and the client's all in favor of a
  mod_perl solution. Phase 2 of the project requires on-the-fly pdf
  creation.
 
  I've done page layout in other languages, so I'm not too concerned
  about coding the thing. My question is:
 
  Does anyone have success/horror stories generating pdf files
  under mod_perl?
  Recommendations?

 About 6 months ago I had a good look at the various modules available for
 PDF creation (for on the fly conversion of XML to PDF using AxKit/mod_perl),
 and found that they all suffered from C-like interfaces (i.e. it was
 $pdf-start_page, $pdf-end_page, instead of that stuff being automatic),
 interface complexity (i.e. changing font and colour mirrored how the
 low-level PDF format worked), and very poor support for incorporating
 images. Anyway, so I wrote my own, based on pdflib (www.pdflib.com), called
 PDFLib.pm. The base pdflib comes with it's own interface called
 pdflib_pl.pm, but again it's a C-like interface. So PDFLib.pm is more OO.
 Well, I'm biased, but I think it works pretty well (though it's lacking
 support for graphics primitives right now), and I use it in AxKit's AxPoint
 package to create all my slideshows (see
 http://217.158.50.178/docs/presentations/tpc2001/).

 One bonus about PDFLib.pm is that the underlying PDF stuff is all done in C,
 so it's likely a bit faster than all the other (pure perl) options.

 I've heard good stuff about PDF::Create though (but I think that's one of
 the ones that didn't support images when I was looking).

 Matt.

 _
 This message has been checked for all known viruses by Star Internet
 delivered through the MessageLabs Virus Scanning Service. For further
 information visit http://www.star.net.uk/stats.asp or alternatively call
 Star Internet for details on the Virus Scanning Service.


Regards,
Oleg
_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




Re: search engine module?

2001-10-17 Thread Oleg Bartunov

We use OpenFTS (http://openfts.sourceforge.net) at
postgresql mailing list archive ( http://fts.postgresql.org).

Regards,
Oleg
On Wed, 17 Oct 2001, Stas Bekman wrote:

 Ged Haywood wrote:

  Hi all,
 
  On Mon, 15 Oct 2001, Ask Bjoern Hansen wrote:
 
 
 On Fri, 12 Oct 2001, Perrin Harkins wrote:
 
 [...]
 
 Plus lots of other stuff like Glimpse and Swish which interface to C-based
 engines.
 
 I've had good luck with http://swish-e.org/2.2/
 
 
  Please make sure that it's possible to do a plain ordinary literal
  text string search.  Nothing fancy, no case-folding, no automatic
  removal of puctuation, nothing like that.  Just a literal string.
 
  Last night I tried to find perl -V on all the search engines
  mentioned on the mod_perl home page and they all failed in various
  interesting ways.
 
  If somebody knows what I'm doing wrong, please post.

 the engine at mathforum does a great job, it's the best mailing list
 archive search engine that I've ever seen, in regards to searching Perl
 strings and code in general. Just make sure to use the right options at:
 http://mathforum.org/discussions/epi-search/modperl.html


 _
 Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
 http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
 mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
 http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Regards,
Oleg
_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




Re:how to secure backend server ?

2001-01-02 Thread Oleg Bartunov

On Tue, 2 Jan 2001, Mike Miller wrote:

 Date: Tue, 2 Jan 2001 11:14:26 -0500
 From: Mike Miller [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Re:how to secure backend server ?
 
 On Tuesday, January 02, 2001, Gunther Birznieks wrote the following
 about "how to secure backend server ?"
 
 GB I am not sure, but I suspect it may be possible to distinctly
 GB bind to 127.0.0.1 and thus disallow any external IP address
 GB listening for extra  measure. The default for apache is to bind to
 GB every IP on the system  promiscuously which you don't want on a BE
 GB server.
 
 You can explicitly bind an apache server to localhost.
 

This works only if frontend and backend are on the same physical server.
But it will not works even in this situation if you have several
proxies running while you want backend accepts requests only from
one specific proxy.

regards,
Oleg

 Best Regards,
 
 Mike Miller
 [EMAIL PROTECTED]
 
 

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




Re: how to secure backend server ?

2001-01-02 Thread Oleg Bartunov

On Tue, 2 Jan 2001, Gunther Birznieks wrote:

 Date: Tue, 02 Jan 2001 23:41:01 +0800
 From: Gunther Birznieks [EMAIL PROTECTED]
 To: Matt Sergeant [EMAIL PROTECTED], Oleg Bartunov [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: how to secure backend server ?
 
 At 03:02 PM 1/2/01 +, Matt Sergeant wrote:
 On Tue, 2 Jan 2001, Oleg Bartunov wrote:
 
   Hi,
  
   I have implement standard  fe-be scheme as many times discussed
   in this list and described by Stas in his guide. Sorry, if I
   don't understand something simple.
  
   Everything works but I get a problem with securing my
   backend server - I want backend accepts requests only from my frontend.
   I have in backend's conf file:
  
   Directory "/db1/w3/comps/discovery"
   Options  FollowSymLinks ExecCGI Includes MultiViews
   AllowOverride All
   Order deny,allow
   Deny from all
   Allow from MY_PROXY_IP
   /Directory
 
 Forget that, add the rule to your firewall. Its a far better place to
 manage these kinds of rules.
 
 I am not sure, but I suspect it may be possible to distinctly  bind to 
 127.0.0.1 and thus disallow any external IP address listening for extra 
 measure. The default for apache is to bind to every IP on the system 
 promiscuously which you don't want on a BE server.

Well, is it possible to tell apache to bind only one IP which
is explicitly writen in Listen command ?
Interesting, that I see right IP of proxy when I print environment 
but when request comes to backend I see wrong IP in
$r-connection-remote_ip !

Also, in my original post I wrote that on my observation 
request passes twice access control - the first with proxy IP address
(passes ok by configuration) and the second one with original client's IP
which failes also by configuration. And this cause the problem.
Does this correct behaivour ? In my understanding PerlPostReadRequestHandler
is in the beginning of lifecycle of request.


 
 Of course, you will need the firewall method if the BE server actually is 
 on a physically separate machine from the FE server.
 
 Where security is concerned, it's not always the best idea to solely depend 
 on firewall rules if you can help it... In case one gets misconfigured at 
 least you have a 2nd one.
 
 Anyway, unless your mod_rewrite rules on the FE server are doing something 
 other than blindly proxying all requests to the BE server, I am not sure 
 whether the BE server is actually any more secure because of the reverse 
 proxy.
 
 What attack could be made on the BE server directly that could not be made 
 through just tunneling the same request through mod_rewrite on the FE server?
 
 eg Are you filtering for "passwd" in the URL with your rewrite rules?
 

True security is to pull out network cable :-)
Now I have academic interest to understand what I've seen.

regards,

Oleg

 

_____
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




Re: [ANNOUNCE] New mod_perl Web Site!!!

2000-12-05 Thread Oleg Bartunov

Matt,

I know you like modern technologies but your site doesn't like
my browser (NS 3.0, Solaris). I got blank screen with 2 popup
windows with message "/bin/sh: gzip: not found"
Hope you know what does it mean :-)

Regards,

Oleg
On Tue, 5 Dec 2000, Matt Sergeant wrote:

 Date: Tue, 05 Dec 2000 10:42:20 +
 From: Matt Sergeant [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [ANNOUNCE] New mod_perl Web Site!!!
 
 With a flash of fireworks and champagne I'd like to announce to the world
 our new mod_perl news and advocacy web site:
 
 http://modperl.sergeant.org/
 
 We hope to be able to bring to you all the latest relevant perl news, and
 articles about mod_perl development and other areas of interest, all in
 once place. We also have a copy of the mod_perl guide on the site, broken
 down into sections - we hope you like this format. Eventually we will
 have all the mod_perl documentation from the source POD files, and allow 
 users to add comments (much like you can with the PHP documentation), and
 we have much more planned for the site.
 
 The entire site is built using AxKit and a small mod_perl handler for   
 uploading news articles.
 
 We hope you like the design, although we are aware that there are a couple
 of issues with it currently:
 
   - We don't have O'Reilly's permission to use the eagle logo, so will
 probably have to do a bit of a re-design
   - We need to find a reasonably nice way to integrate advertising onto
 the site.
 
 If you have any article or news item you would like to see published on
 the site, then please visit our contribute page on the site, or drop us a
 line at [EMAIL PROTECTED]
 
 Enjoy,
 
 The modperl.sergeant.org editing team.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: 1.22_01-dev: Modification of a read-only value ...

2000-04-04 Thread Oleg Bartunov

On Tue, 4 Apr 2000, Doug MacEachern wrote:

 Date: Tue, 4 Apr 2000 14:27:28 -0700 (PDT)
 From: Doug MacEachern [EMAIL PROTECTED]
 To: Oleg Bartunov [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: 1.22_01-dev: Modification of a read-only value ...
 
  No, this doesn't fixed the problem. I applied your patch to current cvs
 
 hmm, does the problem go away if you add this to httpd.conf:
 
 PerlModule Apache::Table

Yes ! It works now after I add Apache::Table to my startup.pl

 
 ?  that's my only suspect, since the first time you access $r-headers_in
 it will 'require Apache::Table', which might confuse the stack pointer.
 

Got that, why it worked before :0)

Oleg

 

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




Re: 1.22_01-dev: Modification of a read-only value ...

2000-04-03 Thread Oleg Bartunov

On Sun, 2 Apr 2000, Doug MacEachern wrote:

 Date: Sun, 2 Apr 2000 21:20:09 -0700 (PDT)
 From: Doug MacEachern [EMAIL PROTECTED]
 To: Oleg Bartunov [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: 1.22_01-dev: Modification of a read-only value ...
 
 On Sun, 2 Apr 2000, Oleg Bartunov wrote:
 
  Hi,
  
  With 1.22_01-dev I got an error:
  
  [Sun Apr  2 16:50:03 2000] [error] Modification of a read-only value attempted at 
/usr/local/apache/lib/perl/My/ProxyRemoteAddr.pm line 15, DATA chunk 1.
 
 hmm, 1.22_01-dev is supposed to fix that problem, does it make a
 difference if you backout this change?

No, this doesn't fixed the problem. I applied your patch to current cvs

Oleg

 
 --- src/modules/perl/mod_perl.c   2000/03/31 05:16:05 1.112
 +++ src/modules/perl/mod_perl.c   2000/04/03 04:19:53
 @@ -1562,7 +1562,6 @@
   if(stash) /* check again */
   is_method = perl_handler_ismethod(stash, method);
  #endif
 - SPAGAIN; /* reset stack pointer after require() */
   }
   
   if(!is_method  !defined_sub) {
 

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




1.22_01-dev: Modification of a read-only value ...

2000-04-02 Thread Oleg Bartunov

Hi,

With 1.22_01-dev I got an error:

[Sun Apr  2 16:50:03 2000] [error] Modification of a read-only value attempted at 
/usr/local/apache/lib/perl/My/ProxyRemoteAddr.pm line 15, DATA chunk 1.

Here is the code:
 my $header = $r-headers_in-{'X-Forwarded-For'};
^^
  if ( my $ip = (split /,\s*/, $header)[-1] ) {
 $r-connection-remote_ip($ip);
  }

What's wrong ? 1.22 works fine.

Regards,

Oleg
_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83





Re: [install warnings] apxs

2000-03-30 Thread Oleg Bartunov

Stas,

this is fixed in current modperl CVS,

"Apache::src::apxs fixups to quiet warnings if apxs doesnt exist or
httpd is not dso enabled, thanks to Oleg Bartunov and Ville Skyttä for 
spotting"


Regards,

Oleg
On Thu, 30 Mar 2000, Stas Bekman wrote:

 Date: Thu, 30 Mar 2000 14:19:12 +0200 (IST)
 From: Stas Bekman [EMAIL PROTECTED]
 To: mod_perl list [EMAIL PROTECTED]
 Subject: [install warnings] apxs
 
 Hi,
 
 While doing a simple:
 perl Makefile.PL DO_HTTPD=1 APACHE_SRC=../apache_1.3.12/src
 
 for each Makefile.PL in all subdirs I get:
 
 which: no apxs in (.:/usr/bin:/bin [snipped])
 apxs:Error: Sorry, no DSO support for Apache available
 apxs:Error: under your platform. Make sure the Apache
 apxs:Error: module mod_so is compiled into your server
 apxs:Error: binary `/usr/local/apache/bin/httpd'.
 
 which is triggered by $src-inc in:
 
 WriteMakefile(
 NAME  = "Apache",
 VERSION_FROM = "Apache.pm",
 'INC' = $src-inc,
 'TYPEMAPS'  = $src-typemaps,
 );
 
 in each Makefile.PL in subdirs
 
 Which [$src-inc] in turn calls Apache::src::apxs
 
 Well, these are just two warnings.
 
 1. 
 which: no apxs in (.:/usr/bin:/bin)
 
 says that I don't have apxs in the path.
 
 2.
 apxs:Error: Sorry, no DSO support for Apache available
 apxs:Error: under your platform. Make sure the Apache
 apxs:Error: module mod_so is compiled into your server
 apxs:Error: binary `/usr/local/apache/bin/httpd'.
 
 I happen to have /usr/local/apache/bin/apxs, which triggers the latter.
 
 Anyway why should the Apache::src::apxs method to be called when I don't
 need APXS?
 
 [os: linux RH6.1 perl 5.003 mod_perl-1.22 apache-1.3.12]
 
 __
 Stas Bekman | JAm_pH--Just Another mod_perl Hacker
 http://stason.org/  | mod_perl Guide http://perl.apache.org/guide/ 
 mailto:[EMAIL PROTECTED]  | http://perl.orghttp://stason.org/TULARC/
 http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
 --
 

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




Re: Apache::StatINC.pm

2000-03-28 Thread Oleg Bartunov

Sorry for a little off-thread.
What will happen if I use shared library
generated by SWIG when it's updated but
perl module, which is just a wrapper, doesn't
changed. Does Apache::StatINC.pm will take care ?
Do I need just 'touch' perl module.

regards,
Oleg
On Mon, 27 Mar 2000, Ask Bjoern Hansen wrote:

 Date: Mon, 27 Mar 2000 23:56:58 -0800 (PST)
 From: Ask Bjoern Hansen [EMAIL PROTECTED]
 To: "[iso-8859-1] René Seindal" [EMAIL PROTECTED]
 Cc: Ken Williams [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: Re: Apache::StatINC.pm
 
 On Mon, 27 Mar 2000, Ask Bjoern Hansen wrote:
 
 [...]
   setting a variable with PerlSetVar would change it to what we have
   proposed.
  
  Or maybe it could try the other if the first doesn't work. (Except that
  might get very confusing.. hmn).
 
 Sorry about following up to my own message.
 
 Maybe the clued thing to do would be making our own "require" and add the
 functionality that is like doing a bare "do" of the old filename. (And
 change everything so it would end up doing both what you and Ken is
 proposing and the old thing.
 
 
  - ask
 
 -- 
 ask bjoern hansen - http://www.netcetera.dk/~ask/
 more than 70M impressions per day, http://valueclick.com
 

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




Re: Using network appliance Filer with modperl

2000-02-02 Thread Oleg Bartunov

On Wed, 2 Feb 2000, Stas Bekman wrote:

 Date: Wed, 2 Feb 2000 20:21:20 +0200 (IST)
 From: Stas Bekman [EMAIL PROTECTED]
 To: Pascal Eeftinck [EMAIL PROTECTED]
 Cc: mod_perl list [EMAIL PROTECTED]
 Subject: Re: Using network appliance Filer with modperl
 # DESTROY makes all kinds of cleanups if the fuctions were interuppted
 # before their completion and haven't had a chance to make a clean up.
 ###
 sub DESTROY{
   my $self = shift;
 
   $self-sql_unlock_tables() if defined $self-{lock};
 
   $self-{sth}-finish if defined $self-{sth} and $self-{sth};
   $self-{dbh}-disconnect if defined $self-{dbh} and $self-{dbh};
 
 } # end of sub DESTROY

Stas, are you sure DESTROY executed when children died ?
I'm using ApacheDBI and have problem with DESTROY when I use
finish or disconnect methods.

Regards.
Oleg

 
 
 
 
 ___
 Stas Bekmanmailto:[EMAIL PROTECTED]  http://www.stason.org/stas
 Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC
 perl.apache.orgmodperl.sourcegarden.org   perlmonth.comperl.org
 single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
 

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



Re: Using network appliance Filer with modperl

2000-02-02 Thread Oleg Bartunov

On Wed, 2 Feb 2000, Stas Bekman wrote:

 Date: Wed, 2 Feb 2000 22:03:38 +0200 (IST)
 From: Stas Bekman [EMAIL PROTECTED]
 To: Oleg Bartunov [EMAIL PROTECTED]
 Cc: mod_perl list [EMAIL PROTECTED]
 Subject: Re: Using network appliance Filer with modperl
 
 On Wed, 2 Feb 2000, Oleg Bartunov wrote:
 
  On Wed, 2 Feb 2000, Stas Bekman wrote:
  
   Date: Wed, 2 Feb 2000 20:21:20 +0200 (IST)
   From: Stas Bekman [EMAIL PROTECTED]
   To: Pascal Eeftinck [EMAIL PROTECTED]
   Cc: mod_perl list [EMAIL PROTECTED]
   Subject: Re: Using network appliance Filer with modperl
   # DESTROY makes all kinds of cleanups if the fuctions were interuppted
   # before their completion and haven't had a chance to make a clean up.
   ###
   sub DESTROY{
 my $self = shift;
   
 $self-sql_unlock_tables() if defined $self-{lock};
   
 $self-{sth}-finish if defined $self-{sth} and $self-{sth};
 $self-{dbh}-disconnect if defined $self-{dbh} and $self-{dbh};
   
   } # end of sub DESTROY
  
  Stas, are you sure DESTROY executed when children died ?
  I'm using ApacheDBI and have problem with DESTROY when I use
  finish or disconnect methods.
 
 Of course! This works for me:
 die.pl
 
 use MyRun;
 print "Content-type: text/plain\n\n";
 print "hi\n";
 my $obj = new MyRun;
 die "dying...";
 print "End of program\n";
 
 MyRun.pm
 
 package MyRun;
 sub new{  return bless {}, shift;}
 DESTROY{ print STDERR "destructor was called\n";}
 1;

Such simple DESTROY works for me also.

 
 The disconnect method shouldn't work as it gets overriden by Apache::DBI
 with NOP. However finish() is supposed to work.

I'm not sure it works:

sub disconnect {
 my $self = shift;
 $self-sth_finish;
 warn "STH finished...\n";
 $self-{dbh}-disconnect;
 warn "DB disconnected...\n";
}

sub sth_finish {
 my $self = shift;
 foreach my $sth (keys %query) {
   $self-{$sth}-finish;
 }
}

sub DESTROY {
  my $self = shift;
  $self-disconnect;
  print STDERR "DB requests:PID:",$$,':', $self-total_db_requests(),"\n";
}
I never get  debug messages in error log. But If I comment
all calling of methods I got what I expected.
sub disconnect {
 my $self = shift;
# $self-sth_finish;
 warn "STH finished...\n";
# $self-{dbh}-disconnect;
 warn "DB disconnected...\n";
}

sub DESTROY {
  my $self = shift;
  $self-disconnect;
  print STDERR "DB requests:PID:",$$,':', $self-total_db_requests(),"\n";
}

This behaivour doesn't depends whether or not I use ApacheDBI


Another question:
 
It seems DESTROY doesnt' executed when apache+mod_perl chidlren get killed :-)


Regards,

Oleg


 
 ___
 Stas Bekmanmailto:[EMAIL PROTECTED]  http://www.stason.org/stas
 Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC
 perl.apache.orgmodperl.sourcegarden.org   perlmonth.comperl.org
 single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
 

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



Re: Failed to set ProxyReceiveBufferSize

1999-12-04 Thread Oleg Bartunov

On Sat, 4 Dec 1999, Stas Bekman wrote:

 Date: Sat, 4 Dec 1999 19:52:07 +0200 (IST)
 From: Stas Bekman [EMAIL PROTECTED]
 To: Oleg Bartunov [EMAIL PROTECTED]
 Cc: mod_perl list [EMAIL PROTECTED]
 Subject: Re: Failed to set ProxyReceiveBufferSize
 
  "OB" == Oleg Bartunov [EMAIL PROTECTED] writes:
 
 OB This message is for every proxied request.
 OB Does anybody knows what does it means ?
 OB In proxy config I have 
 OB ProxyReceiveBufferSize 1048576
 
 OB Restarting proxy server doesn't helps.
 
 OB btw, anybody know what is an optimal size of ProxyReceiveBufferSize
 OB and does it really works.
 
 As a followup to Vivek's email, I've digged up in the linux kernel
 sources, the 2 relevant snippets are:
 
 /usr/src/linux/net/core/sock.c:
 
 /* Run time adjustable parameters. */
 __u32 sysctl_wmem_max = SK_WMEM_MAX;
 __u32 sysctl_rmem_max = SK_RMEM_MAX;
 __u32 sysctl_wmem_default = SK_WMEM_MAX;
 __u32 sysctl_rmem_default = SK_RMEM_MAX;
 [snip]
 case SO_RCVBUF:
   /* Don't error on this BSD doesn't and if you think
  about it this is right. Otherwise apps have to
  play 'guess the biggest size' games. RCVBUF/SNDBUF
  are treated in BSD as hints */
  
  if (val  sysctl_rmem_max)
val = sysctl_rmem_max;
 
  /* FIXME: is this lower bound the right one? */
  sk-rcvbuf = max(val*2,256);
  break; 
 
 
 
 
 
 /usr/src/linux/include/linux/skbuff.h:
 /* These are just the default values. This is run time configurable.
  * FIXME: Probably the config option should go away. -- erics
  */
 
 # ifdef CONFIG_SKB_LARGE
 #define SK_WMEM_MAX 65535
 #define SK_RMEM_MAX 65535
 #else
 #define SK_WMEM_MAX 32767
 #define SK_RMEM_MAX 32767
 #endif
 
 
 So the limit is either 32k or 64k, depending on CONFIG_SKB_LARGE...
 If you set it bigger it silently uses the default value as you see in the
 first code snippet
 
 I used to write a 1Mb example in the guide. Have removed the rewishful
 setting :)

No, don't remove it. Under FreeBSD it's possible to
configure kernel to have more buffers for socket:

sysctl -w kern.ipc.maxsockbuf=2621440

I did this and errors are gone now ! I still use 1Mb value.
Probably it's worth to comment this in your guide.

Regards,

Oleg

 
 
 ___
 Stas Bekman  mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas  
 Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
 www.apache.org   www.perl.com  == www.modperl.com  ||  perl.apache.org
 single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
 

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



pool of DB connections ?

1999-11-29 Thread Oleg Bartunov

Hi,

I'm using mod_perl, DBI, ApacheDBI and was quite happy
with persistent connections httpd-postgres until I used
just one database. Currently I have 20 apache servers which
handle 20 connections to database. If I want to work with
another database I have to create another 20 connections
with DB. Postgres is not multithreading
DB, so I will have 40 postgres backends. This is too much.
Any experience ?

Regards,
Oleg
_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



httpd headers for $r-internal_redirect_handler

1999-11-11 Thread Oleg Bartunov

Hi,

I'm trying to use RandPictire.pm from the Book with internal redirect
and it works fine. But in this case URL /random/picture  remains the same
and browser caches output ( I have default expire headers for images
"access plus 100 days" ). To avoid this I tried to set httpd header with
Pragma: no-cache but has no success. Is it possible to supply
correct http headers for internal redirect ?

Here is a code:

   my $headers = $r-headers_out;
   $headers-{'Pragma'} = $headers-{'Cache-control'} = 'no-cache';
   $r-no_cache(1);
   $r-internal_redirect_handler("${lucky_one}");
   return OK;


Regards,

Oleg


_____
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



No permission to access document after $r-internal_redirect

1999-10-29 Thread Oleg Bartunov

Hi,

I have modperl handler which redirect user to random document
and it works fie if I use:
 $r-header_out(Location = 'pubs.html?msg_id='.$msg_id);
 return REDIRECT;

but if I use internal redirect:

  $r-internal_redirect($random_uri);
  return OK;

I get:

 You don't have permission to access
   http://mira.sai.msu.ru:5000/db/pubs.html?msg_id=67 on this server.

If I access directly that URL I have no problem.

This is a 2-server configuration with proxy-frontend and cgi-backend - 
port 5000 - proxy and port 7000 - backend.


Oleg 

I 



_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



How to know PID of DB backend ?

1999-10-28 Thread Oleg Bartunov

Using ApacheDBI I keep persistent connections between
httpd and db. Now I want to know PIDs of httpd children and
database backend. For the httpd it's trivial but I don't
know where to get PID of db backend.

Regards,
Oleg

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




at /opt/perl5/lib/site_perl/5.005/i686-linux/Apache/SIG.pm line 31.

1999-10-21 Thread Oleg Bartunov

Hi,

today I found in httpd's error_log a bunch of messages like

at /opt/perl5/lib/site_perl/5.005/i686-linux/Apache/SIG.pm line 31.

I looked in error_log because server doesn't responds.
In system log files I found "unable to run interpreter".

What does it means ? I run apache 1.3.9 + modperl 1.21_01-dev

Regards,

Oleg
_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



How to disconnect persistent db connections when killing httpd

1999-10-18 Thread Oleg Bartunov

Hi,

I keep persistent db connections and would like to 
explicitly disconnect db when killing httpd.
I have custom module where I initialize db connection, prepare sth's
( will use them in Mason components ) once for per children
and several methods which have deal with my database. Here I have
DESTROY method which supposed to disconnect all connections.

sub DESTROY {
  my $self= shift;
  $self-disconnect;
  warn "Db connection finished $self ...\n";
}

$self-disconnect is a sub which finish all sth's and disconnects connection
with db. But I have nothing in error log when I kill httpd and I didn't
understand what's happens because if I comment call $self-disconnect
I see messages from DESTROY method foreach children:
Db connection finished My::DB=HASH(0x80cd240) ...

So, is't worth to try explicitly disconnect db when httpd gets killed
and how to do this using standard method like DESTROY without
catching signals and etc.

Another question:
If I keep persistent connection httpd - db and did some changes in 
db, say dump/reload table. How to refresh existing dbh ?


Regards,

Oleg 


I wrote script to emulate above. I expected warn message from DESTROY 
method when script finished.
1. DESTROY is just warn
  18:38[zeus]:~/app/discovery/test/bench/dbitt.pl
  Db connection finished My::DB=HASH(0x80cd240) ...
2. DESTROY calls $self-disconnect and then warn
  18:40[zeus]:~/app/discovery/test/bench/dbitt.pl 
  
  Nothing is there.




test script:

#!/usr/local/bin/perl
use strict;
use My::DBtest;

# use this connect string
$ENV{DBI_DSN} = "dbi:Pg(RaiseError=1,AutoCommit=0):dbname=discovery";
#DBI-trace(2);
 my ($dbh, $count );
 $dbh = My::DB-new(1);
# $dbh-disconnect;

--

Simplified version of module My/DBtest.pm

package My::DB;
$VERSION = 0.1;
use strict;
use DBI;

my %query = (
   sth0 = 'select count(*) from messages',
);
my $self = {};


sub new {
  my $proto = shift;
  my $class = ref($proto) || $proto;
  $self-{dbh} = DBI-connect() or die ("Connections fails; $!\n");
  prepare_sth($self);
  bless ( $self, $class);
  $self;
}

sub prepare_sth {
my $self = shift;
foreach my $sth (keys %query) {
   $self-{$sth} = $self-{dbh}-prepare ( $query{$sth});
}
}

sub disconnect {
 my $self = shift;
 $self-sth_finish;
 $self-{dbh}-disconnect;
 warn "disconnected ..\n";
}

sub sth_finish {
  my $self = shift;
  foreach my $sth (keys %query) {
   $self-{$sth}-finish;
  }
}


sub DESTROY {
  my $self= shift;
  $self-disconnect;
  warn "Db connection finished $self ...\n";
}

1;
_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83





Re: More on web application performance with DBI

1999-10-14 Thread Oleg Bartunov

On Thu, 14 Oct 1999, Perrin Harkins wrote:

 Date: Thu, 14 Oct 1999 17:53:15 -0700 (PDT)
 From: Perrin Harkins [EMAIL PROTECTED]
 To: Jeffrey Baker [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: Re: More on web application performance with DBI
 
 On Thu, 14 Oct 1999, Jeffrey Baker wrote:
  Zero optimization: 41.67 requests/second
  Stage 1 (persistent connections): 140.17 requests/second
  Stage 2 (bound parameters): 139.20 requests/second
  Stage 3 (persistent statement handles): 251.13 requests/second
 
 I know you said you don't like it because it has extra overhead, but would
 you mind trying stage 3 with prepare_cached rather than your custom
 solution with globals?  For some applications with lots of SQL statements,
 the prepare_cached appraoch is just much more manageable.

Some databases doesn't support caches of prepared plans.
PostgreSQL for example. So I think Jeffrey's approach is more
generic. But I agree with you if database supports this feature 
it's worth to use it.


 
  It is interesting that the Stage 2 optimization didn't gain anything
  over Stage 1.
 
 I think Oracle 8 is doing some magic by parsing your SQL and matching it
 up to previous statements, whether you use bind variables or not.  It may
 matter more on other databases.
 
 - Perrin
 

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



secure way to connect to database

1999-10-13 Thread Oleg Bartunov

Hi,

I'm developing Web application with database (postgres) backend
and would like to know what is the right and secure way to establish 
connection to database. I worry about password which has to be
specified in DBI-connect. There are many scripts, .htaccess and
I don't want to spread password, even if I could maintain 
file access permissions. Previously, I just used environment
variable DBI_DSN (in httpd.conf) to describe database and used
DBI-connect() method to access database. It was very convenient
because you have only one place in http.conf where you configure
coonection stuff. You can even  omit any connection stuff in .htaccess
I use Mason and in all components I use database handler already
defined in Mason's handler. This is ok if datbabase you work with 
doesn't requires password for connection. Now I need to figure
out how to keep my work simple (as above) and specify password
in one place, which I for sure could keep secure.
There is possbility to use environment DBI_PASS in httpd.conf
but obviously it's very dangerous and this doesn't work for some
reason - BDI-connect failed, while DBI_PASS is there and
shell script works fine (Edmund, have you tried DBI_PASS env. variable )
Anyway, it's not secure way and I'm asking your recommendation.


Regards,

Oleg


_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



http headers for cache-friendly modperl site

1999-10-11 Thread Oleg Bartunov

Andreas,

sorry for bothering you :-)

I found your nice introduction to http-headers
(Apache-correct_headers-1.16) and want to ask you
some questions.

1. Do you have some examples on-line to illustrate
   cache-friendly dynamical pages ?

2. I'm building server with fully dynamic content using
   Apache, modperl and HTML::Mason and would like to implement
   cache-friendly strategy you described. But I have some problem:
   In Russia we have several encodings for russian language
   ( koi8-r - mostly Unix, win-1251 - mostly windows and several
   others). Documents generated in native server's encoding and
   translated to another encoding on-fly depending on several
   parameters (user directly specify port number for example or
   server understand on some logic (by User Agent string for example) what 
   encoding would be the best for user). If user directly selected
   port number URL would changed, say http://some.host:8100/ for koi8-r
   and http://some.host:8101/ for win-1251. In such situation there
   are no problem with caching on proxy servers because URL's are different.
   But in case when server automagically recognize encoding of client
   URL stays the same for differnet encodings - just http://some.host/
   and this cause a trouble with proxy. Suppose if user1 from windows machine
   and user2 from Unix request the same document using the same proxy.
   Then if user1 was the first and proxy caches document in win-1251 encoding
   and user2 will get document from the proxy but in wrong encoding.
   user2 could press reload button and gets proxy refresh document
   now in koi8-r encoding and so on. This is a pain.
   So here is my question: What's correct way to configure http header 
   in this situation ? Actually, the situation I described probably
   would be closer to you if, for example, server generates content
   depending on User Agent, no translation, just different design.
 
  I see probable solution: Lets browser use local cache and when document
  is expired lets proxy to revalidate it from server and not get it from cache.
  It's already big win if user could use local cache.  
  I don't know how to realize this solution in frame of HTTP 1.0.
  Most proxy support only HTTP 1.0. In my experiments I used
  Apache's Expire and headers modules.
ExpiresByType text/html "access plus 2 hours"  
  and this enough for browsers to use local cache 
  but unfortunately
  proxy servers also cache documents and I got the problem I described above.
  Is it possible to separate proxy's cache and browser's cache using
  http-headers ? Again using HTTP 1.0 ?

I search mailing lists and internet resources but didn't found
solution for my problem. I'm doing Cc: to modperl mailing list
in hope people already found the solution.
 
  Best regards,

Oleg 

_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




Re: http headers for cache-friendly modperl site

1999-10-11 Thread Oleg Bartunov

On 11 Oct 1999, Andreas J. Koenig wrote:

 Date: 11 Oct 1999 12:48:54 +0200
 From: "Andreas J. Koenig" [EMAIL PROTECTED]
 To: Oleg Bartunov [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: Re: http headers for cache-friendly modperl site
 
  On Mon, 11 Oct 1999 13:18:12 +0400 (MSD), Oleg Bartunov [EMAIL PROTECTED] said:
 
   1. Do you have some examples on-line to illustrate
  cache-friendly dynamical pages ?
 
 On www.stadtplandienst.de the headers for the graphics have optimal
 headers, I think. The headers for HTML could be improved though.
 
 On the other machines where I have prepared everything to be
 cache-friendly, I yet have to decide about a good expiration schedule.
 And as often, without a pressing need, I haven't yet come around to
 finetune it.

Thanks for references. I could recommend also mailing list archive
http://www.progressive-comp.com/Lists/ which is cache-friendly
with dynamic content site. Also is very useful.


 
   2. I'm building server with fully dynamic content using
  Apache, modperl and HTML::Mason and would like to implement
  cache-friendly strategy you described. But I have some problem:
  In Russia we have several encodings for russian language
  ( koi8-r - mostly Unix, win-1251 - mostly windows and several
  others). Documents generated in native server's encoding and
  translated to another encoding on-fly depending on several
  parameters (user directly specify port number for example or
  server understand on some logic (by User Agent string for example) what 
  encoding would be the best for user). If user directly selected
  port number URL would changed, say http://some.host:8100/ for koi8-r
  and http://some.host:8101/ for win-1251. In such situation there
  are no problem with caching on proxy servers because URL's are different.
  But in case when server automagically recognize encoding of client
  URL stays the same for differnet encodings - just http://some.host/
  and this cause a trouble with proxy. Suppose if user1 from windows machine
  and user2 from Unix request the same document using the same proxy.
 
 This is exactly the same problem for any content negotiation. If you
 are using content negotiation, you *must* specify the Vary header as
 described in my document. But as soon as you have a Vary header, you
 are out of luck with regard to caching proxies because squid is unable
 to cache documents with a Vary header (it just expires them
 immediately) and I believe there is no other Proxy available that does
 handle Vary headers intelligenty. So although you are acting
 cache-friendly and correct, the current available cache technology
 isn't up to the task.
 
 But as a workaround you can and should work with a redirect.
 
 1. Decide about a parameter in the querystring or in the pathinfo or
in the path that codifies everything you would normally handle by
interpreting an incoming header, like Accept, Accept-Encoding,
Accept-Charset, User-Agent, etc.
 
 2. As one of the first things your program should check for the
precense of this parameter in the requested URI.
 
 3. If it is there, you have a unique URI and can answer in a
cache-friendly way. If it isn't there, you code it into the
received URI and answer with a redirect to the URI you just
constructed.

Yes,

I already found workaround to generate unique URL (using different port number)
and it works quite fine. There were some problems in 2 servers setup
(it's easy to get redirection loop) but I found a right way.

Thanks for help,

Oleg

 
 An example: www.meta-list.net, where we roughly do the following,
 where $mgr is an Apache::HeavyCGI object we created earlier and $cgi
 is an Apache::Request object.
 
   my $acc = $cgi-param('acc');
 
   if  (defined($acc)) {
 my $lang;
 ($mgr-{CAN_UTF8},$mgr-{CAN_GZIP},$mgr-{CAN_PNG},$mgr-{Lang}) =
 unpack "a a a a*", $acc;
   } else {
 my $utf8  = $mgr-can_utf8;
 my $gzip  = $mgr-can_gzip;
 my $png   = $mgr-can_png;
 my $lang  = $r-header_in("Accept-Language");
 my $param = $utf8 . $gzip . $png . $mgr-uri_escape($lang);
 my $redir_to;
 if ($r-method_number == M_GET) {
   my $args = $r-args;
   $redir_to = $mgr-myurl . "?acc=$param";
   $redir_to .= "$args" if $args;
 } elsif ($r-method_number == M_POST) {
   warn "We got a POST but we are only prepared for GET!";
   return;
 }
 $r-header_out("Location",$redir_to);
 require Apache::Constants;
 my $stat = Apache::Constants::REDIRECT();
 $r-status($stat);
 $r-send_http_header;
   }
 
 This code doesn't work exactly as posted because I simplified a few
 things to illustrate the point, but I hope it helps clarify things.
 
 -- 
 andreas
 

_
Oleg Ba