Apache::AuthCookie and what's required

2003-01-07 Thread Gareth Kirwan
Title: Gareth Stationery



Morning all,

Diving straight in... This is my first time 
using Apache::AuthCookie for Authorization and Authentication ... but when I've 
been pencilling my plan out I'm already afraid
I might need to go a different route - so I 
thought I'd post here and see what kind of response I got.

My problem is that I can't find enough 
documentation on how to use the further require statements.
The user's group is defined in a database, 
and so is the access level of the page requested.
Hence I'm thinking that I'll need something 
using the model of require species hamster ( from Apache::AuthCookie 
documentation )
However I can't find out the significance of 
the word species ...

hamster is the subroutine in the subclass 
that will be called and sent $r and $args, but where does the notion of species come from 
?

Hope this question is too bad 
:D

Cheers

Gareth 
KirwanProgramming  Development,Thermeon Europe Ltd,[EMAIL PROTECTED] Tel: +44 
(0) 1293 864 303Thermeon 
Europe e-Card: gbjk 


Re: Apache::AuthCookie and what's required

2003-01-07 Thread domm
Hi!

On Tue, Jan 07, 2003 at 09:30:32AM -, Gareth Kirwan wrote:

 Hence I'm thinking that I'll need something using the model of require
 species hamster ( from Apache::AuthCookie documentation )
 However I can't find out the significance of the word species ...
 
 hamster is the subroutine in the subclass that will be called and sent $r
 and $args, but where does the notion of species come from ?

it's the other way round:

if you say in httpd.conf
  require species hamster
  
Apache::AuthCookie will call
 species() in your subclass and passing haster in $args

From perldoc Apache::AuthCookie:

o authorize()
This will step through the require directives you've
given for protected documents and make sure the user
passes muster.  The require valid-user and require
user joey-jojo directives are handled for you.  You
can implement custom directives, such as require
species hamster, by defining a method called
species() in your subclass, which will then be
called.  The method will be called as $r-species($r,
$args), where $args is everything on your require
line after the word hamster.  The method
should return OK on success and FORBIDDEN on failure.

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}



Re: Apache::AuthCookie and what's required

2003-01-07 Thread domm
Hi!

On Tue, Jan 07, 2003 at 11:20:25AM +0100, [EMAIL PROTECTED] wrote:

 From perldoc Apache::AuthCookie:
 
 o authorize()
 This will step through the require directives you've
 given for protected documents and make sure the user
 passes muster.  The require valid-user and require
 user joey-jojo directives are handled for you.  You
 can implement custom directives, such as require
 species hamster, by defining a method called
 species() in your subclass, which will then be
 called.  The method will be called as $r-species($r,
 $args), where $args is everything on your require
 line after the word hamster.  The method
 should return OK on success and FORBIDDEN on failure.

After reading this again, I wonder if there is an error in the doc.

Shouldn't this
 $args), where $args is everything on your require
 line after the word hamster.  The method
  ^
be
 $args), where $args is everything on your require
 line after the word species.  The method
 ^
?



-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}



RE: Apache::AuthCookie and what's required

2003-01-07 Thread Gareth Kirwan
Now THAT makes perfect sense to me!

However that's not what you'll find here:
http://www.perldoc.com/cpan/Apache/AuthCookie.html

This will step through the require directives you've given for protected
documents and make sure the user passes muster. The require valid-user and
require user joey-jojo directives are handled for you. You can implement
custom directives, such as require species hamster, by defining a method
called hamster() in your subclass, which will then be called. The method
will be called as $r-hamster($r, $args), where $args is everything on your
require line after the word hamster. The method should return OK on success
and FORBIDDEN on failure.

Here you'll say that it'll call the method hamster!

What do you think of that ? Typo ?

 it's the other way round:

 if you say in httpd.conf
   require species hamster

 Apache::AuthCookie will call
  species() in your subclass and passing haster in $args

 From perldoc Apache::AuthCookie:

 o authorize()
 This will step through the require directives you've
 given for protected documents and make sure the user
 passes muster.  The require valid-user and require
 user joey-jojo directives are handled for you.  You
 can implement custom directives, such as require
 species hamster, by defining a method called
 species() in your subclass, which will then be
 called.  The method will be called as $r-species($r,
 $args), where $args is everything on your require
 line after the word hamster.  The method
 should return OK on success and FORBIDDEN on failure.

 --
 #!/usr/bin/perl   http://domm.zsi.at
 for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}






Re: Query

2003-01-07 Thread Ken Y. Clark
On Tue, 7 Jan 2003, Chandrasekhar R S wrote:

 Date: Tue, 7 Jan 2003 12:52:27 +0530
 From: Chandrasekhar R S [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Query

 I am having a requirement as follows :

   I need to execute/interpret the perl requests away from mod_perl.  Like,
 could mod_perl delegate the execution/interpretation of perl scripts to some
 other process.  In the end, mod_perl would be used just to accept requests
 from the Web Server, but processing will be done elsewhere and response will
 be routed back through mod_perl.

 - rsr.

 Namaste,
 R S Chandrasekhar
 [EMAIL PROTECTED]
 ISD : 091-080-2052427
 Telnet : 847-2427
 Phone : 2052427

RSR,

You can certainly do something like this, in many different ways.
This *is* still Perl, you know.  :-)  You could use your mod_perl
process to update a queue that's in a file or database table, then
have another process (written in Perl or whatever) executed by a cron
job to look at the queue and process the next job.  The user could be
given a token to associate with the job, then then check back later to
get the results of the job.  If you need it to be more immediate, then
you'll have to get fancier.  If it's a really long-running process you
need to kick off, you'll need to take into account the dangers of
forking your mod_perl process or having it wait around for the end of
the job.

Have you tried searching the archives for similar questions?  Here's
one place you can search:

http://mathforum.org/discussions/epi-search/modperl.html

Namaste,

ky



RE: Query

2003-01-07 Thread Chandrasekhar R S
Hello Ken,
You gave me a glimmer of hope and enthusiasm.  I have scanned through the
recent postings on Mod Perl list in vain.

I would like to know any such standalone servers that could process the
perl requests offline (taking requests from a file or queue end).

I definitely would like to get fancier as my requirement is immediate.
Upon finding a server that could process the requests away from mod_perl, I
most probably would modify mod_perl to communicate with the standalone
servers via sockets (and maybe maintain persistence).

many thanks
rsr.

-Original Message-
From: Ken Y. Clark [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 9:02 PM
To: Chandrasekhar R S
Cc: [EMAIL PROTECTED]
Subject: Re: Query


On Tue, 7 Jan 2003, Chandrasekhar R S wrote:

 Date: Tue, 7 Jan 2003 12:52:27 +0530
 From: Chandrasekhar R S [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Query

 I am having a requirement as follows :

   I need to execute/interpret the perl requests away from mod_perl.  Like,
 could mod_perl delegate the execution/interpretation of perl scripts to
some
 other process.  In the end, mod_perl would be used just to accept requests
 from the Web Server, but processing will be done elsewhere and response
will
 be routed back through mod_perl.

 - rsr.

 Namaste,
 R S Chandrasekhar
 [EMAIL PROTECTED]
 ISD : 091-080-2052427
 Telnet : 847-2427
 Phone : 2052427

RSR,

You can certainly do something like this, in many different ways.
This *is* still Perl, you know.  :-)  You could use your mod_perl
process to update a queue that's in a file or database table, then
have another process (written in Perl or whatever) executed by a cron
job to look at the queue and process the next job.  The user could be
given a token to associate with the job, then then check back later to
get the results of the job.  If you need it to be more immediate, then
you'll have to get fancier.  If it's a really long-running process you
need to kick off, you'll need to take into account the dangers of
forking your mod_perl process or having it wait around for the end of
the job.

Have you tried searching the archives for similar questions?  Here's
one place you can search:

http://mathforum.org/discussions/epi-search/modperl.html

Namaste,

ky




Re: Query

2003-01-07 Thread Perrin Harkins
Chandrasekhar R S wrote:

I am having a requirement as follows :

	I need to execute/interpret the perl requests away from mod_perl.


Can you explain why you want to do this?  Your stated requirement is 
already met by CGI, FastCGI, SpeedyCGI, and a bunch of other things, but 
we can't really recommend anything specific without more information.

- Perrin



[mp2] config: Perl directive missing closing ''

2003-01-07 Thread Dmitri Tikhonov

Hi,

I am in the process of converting to Apache2/mod_perl2.  My old httpd.conf 
file contains these lines (stuff in the middle omitted):

-
LoadModule perl_module /usr/libexec/mod_perl.so
Perl
$ServerAdmin = 'admin@'.`hostname`;
/Perl
-

After LoadModule directive, I added this line:

-
PerlRequire /etc/httpd/conf/startup.pl
-

(taken straight from ./docs/user/config/config.pod of mod_perl
distribution) and uncommented 'use Apache::compat' line.

When I start apache, I see this error:

-
[root@audrey conf]# /usr/sbin/httpd -f /etc/httpd/conf/httpd.conf 
Syntax error on line 90 of /etc/httpd/conf/httpd.conf:
Perl directive missing closing ''
[root@audrey conf]# 
-

I only found this recent thread  -- 
http://www.mail-archive.com/dev@perl.apache.org/msg03485.html -- I think 
it talks about Perl directive support not being finished (?)  Is that 
correct?  Documentation on Perl section is empty 
(http://perl.apache.org/docs/2.0/user/config/config.html#C_E_lt_PerlE_gt___Sections).

I have no idea what's going on.  What am I missing?  Is there another set
of documentation that explains this behavior?

My setup: apache 2.0.43, mod_perl 1.99_07.

Thanks in advance.

- Dmitri.




RE: Query

2003-01-07 Thread Ken Y. Clark
On Tue, 7 Jan 2003, Chandrasekhar R S wrote:

 Date: Tue, 7 Jan 2003 21:38:57 +0530
 From: Chandrasekhar R S [EMAIL PROTECTED]
 To: 'Ken Y. Clark' [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: RE: Query

 Hello Ken,
   You gave me a glimmer of hope and enthusiasm.  I have scanned through the
 recent postings on Mod Perl list in vain.

   I would like to know any such standalone servers that could process the
 perl requests offline (taking requests from a file or queue end).

   I definitely would like to get fancier as my requirement is immediate.
 Upon finding a server that could process the requests away from mod_perl, I
 most probably would modify mod_perl to communicate with the standalone
 servers via sockets (and maybe maintain persistence).

 many thanks
 rsr.

RSR,

I really think you're making this harder than it is.  As was pointed
out by another poster, there's nothing about your problem as you've
described it that requires mod_perl.  A simple CGI script could take
your user input, write something to a file or database, and return a
job ID.  A separate Perl script could be launched every 60 seconds by
crond and inspect the file or database for new jobs, process them, and
write the results to another file or update the table.  The user could
then check back later with the original job ID for the results.
There's no need for you to look for a server that could process the
requests away from mod_perl.  There's nothing wrong with the standard
toolset that Unix already provides.  And I really don't understand why
you want to use sockets.  First just solve your problem using the
simplest solutions.  If you then find things aren't performing to your
expectations, tweak.  Remember:  Premature optimization is the root
of all evil (Hoare).

That's just one of many ideas you could use given how little I
actually know about your problem.  As none of what we've talked about
involves mod_perl, I suggest we end this thread.

Best of luck,

ky

 -Original Message-
 From: Ken Y. Clark [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 07, 2003 9:02 PM
 To: Chandrasekhar R S
 Cc: [EMAIL PROTECTED]
 Subject: Re: Query


 On Tue, 7 Jan 2003, Chandrasekhar R S wrote:

  Date: Tue, 7 Jan 2003 12:52:27 +0530
  From: Chandrasekhar R S [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Subject: Query
 
  I am having a requirement as follows :
 
  I need to execute/interpret the perl requests away from mod_perl.  Like,
  could mod_perl delegate the execution/interpretation of perl scripts to
 some
  other process.  In the end, mod_perl would be used just to accept requests
  from the Web Server, but processing will be done elsewhere and response
 will
  be routed back through mod_perl.
 
  - rsr.
 
  Namaste,
  R S Chandrasekhar
  [EMAIL PROTECTED]
  ISD : 091-080-2052427
  Telnet : 847-2427
  Phone : 2052427

 RSR,

 You can certainly do something like this, in many different ways.
 This *is* still Perl, you know.  :-)  You could use your mod_perl
 process to update a queue that's in a file or database table, then
 have another process (written in Perl or whatever) executed by a cron
 job to look at the queue and process the next job.  The user could be
 given a token to associate with the job, then then check back later to
 get the results of the job.  If you need it to be more immediate, then
 you'll have to get fancier.  If it's a really long-running process you
 need to kick off, you'll need to take into account the dangers of
 forking your mod_perl process or having it wait around for the end of
 the job.

 Have you tried searching the archives for similar questions?  Here's
 one place you can search:

 http://mathforum.org/discussions/epi-search/modperl.html

 Namaste,

 ky




Re: Query

2003-01-07 Thread Jean-Michel Hiver
  I definitely would like to get fancier as my requirement is immediate.
  Upon finding a server that could process the requests away from mod_perl, I
  most probably would modify mod_perl to communicate with the standalone
  servers via sockets (and maybe maintain persistence).

Don't. You might want to use SOAP::Lite instead and save some hassle.

But then again as said on the list, if you don't tell us what your
problem is you probably won't have much helpful information.

Cheers,
-- 
Building a better web - http://www.mkdoc.com/
-
Jean-Michel Hiver
[EMAIL PROTECTED]  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/



[mp2] input filter

2003-01-07 Thread Steve
**Hi again. I just noticed my last post regarding this was html formatted,
so I'm going to try again. Sorry about that everybody! **

I'm having some trouble configuring an input filter.. I'm using Apache
2.0.43, mod_perl 1.99_08-dev and perl 5.8.0.

In httpd.conf, I just did this inside a VirtualHost

PerlInputFilterHandler myApache::Filters::filter_in

My code looks something like this:

package myApache::Filters;
#here I loaded different modules etc..
sub filter_in : FilterConnectionHandler{
my ($filter, $bb, $mode, $block, $readbytes) = @_

my $rv =$filter-next-get_brigade($bb, $mode, $block, $readbytes);
return $rv unless $rv = APR::SUCCESS;

print STDERR INPUT FILTER\n;
my $c = $filter-c

return Apache::OK;
}


This is pretty much just taken from the mod_perl filter documenation, so I'm
pretty sure the code is OK.


My problem is this:

From the time I hit refresh in my browser to the time the content appears
takes a very long time. The request
completes eventually, it just takes forever. As soon as I take the filter
handler out of httpd.conf it works perfectly

Is this a configuration issue? Anyone have any ideas as to why this happens?

Thanks a lot

Steve

P.S Thanks for bearing with me through my posting debacles



Re: Apache::DBI

2003-01-07 Thread Randy Kobes
On Mon, 6 Jan 2003, Paul Simon wrote:

 --- Randy Kobes [EMAIL PROTECTED] wrote:
 
  Are you using the latest versions of DBI and
  DBD::ODBC?
  If not, does an upgrade help?
 
 Those modules are - whatever was bundled with your
 first, warmly supplied :), Perl 5.8 + apache2 package
 on theoryx5. Possibly, DBI = 1.30 and DBD::ODBC =
 0.43

If this is still a problem, you might try an upgrade -
both DBI and DBD::ODBC are at newer versions now. We have
ppm packages (for ActivePerl 8xx builds) of them at
   http://theoryx5.uwinnipeg.ca/ppms/

-- 
best regards,
randy




ANNONCE: Apache::Dynagzip 0.09

2003-01-07 Thread Slava Bizyayev
The uploaded file Apache-Dynagzip-0.09.tar.gz has entered CPAN as
file: $CPAN/authors/id/S/SL/SLAVA/Apache-Dynagzip-0.09.tar.gz
size: 30564 bytes
md5: 5b73248a2ae1d8f3bda0a24b9915a653

The main contribution to this version was made by Vlad Jebelev.
Vlad submitted patch which helps to survive possible Apache downgrade from
HTTP/1.1 to HTTP/1.0.

Works fine for me. Thanks Vlad!

Slava




RE: Query

2003-01-07 Thread Chandrasekhar R S
Dear All,
Let me explain my scenario.

We are having a secure OS and we plan to integrate mod_perl with the Apache
webserver already available on the OS.  Being a secure server, it mandates
that none of the exec's be done on the server itself, as these potentially
can be malicious.  Hence we delegate the execution of perl scripts
elsewhere.

Hence, should I be able to integrate mod_perl to my secure web server, I
still would need to receive perl requests through mod_perl only, but rather
than executing the scripts there itself, I should instruct mod_perl to
delegate the interpretation/execution of perl scripts to elsewhere.

This being the requirement, I planned to proceed this way -
1. I would modify mod_perl code to forward a perl request to another
standalone server.  This I planned to do with sockets (rather than employing
Queues, files etc.) since, I would need persistent connections to serve
dynamic perl scripts.

2. I should look for a server that could communicate with mod_perl.  
This
server would execute the perl scripts and return the response back to
mod_perl.  This I call the standalone server.

I will probe all the suggestions you all had sent me.

I shall look for at the POE mail lists.

with thanks
rsr.

-Original Message-
From: Perrin Harkins [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 10:08 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Query


Chandrasekhar R S wrote:
 I am having a requirement as follows :

   I need to execute/interpret the perl requests away from mod_perl.

Can you explain why you want to do this?  Your stated requirement is
already met by CGI, FastCGI, SpeedyCGI, and a bunch of other things, but
we can't really recommend anything specific without more information.

- Perrin





RE: Query

2003-01-07 Thread George Valpak
rsr,

Sounds like you need 2 apaches, on separate physical servers - 

The front end is called thin, and does not have mod perl at all, since nothing will 
run there. It lives mainly to proxy the perl requests to the second apache (often 
called heavy) will live on an inside IP address only (eg. 192.168.x.x or as needed for 
your network). This one has your standard mod perl  stuff and just executes the 
requests it receives. It doesn't need to know anything about the fact that its 
requests are coming and going via proxy at all.

There is excellent documentation on apache.org about how to do this - I just learned 
how to do it myself a couple of weeks ago, although in my case both apaches live on 
the same machine. Basically, the secure thin server needs to support mod_rewrite and 
mod_proxy plus whatever else you need it to do.

If this meets your needs (and it seems like it will) you do not need any socket level 
stuff at all which should make you very happy. Just build your perl code to do what 
you want it to do, and make it run on the inside only server.

The this server can serve fixed html files, images, and so on, or you could proxy them 
from the other apache, or yet another apache on an inside machine if the secure 
machine is not even allowed to do that.

HTH,

GV

At 11:34 AM 1/8/2003 +0530, Chandrasekhar R S wrote:
Dear All,
Let me explain my scenario.

We are having a secure OS and we plan to integrate mod_perl with the Apache
webserver already available on the OS.  Being a secure server, it mandates
that none of the exec's be done on the server itself, as these potentially
can be malicious.  Hence we delegate the execution of perl scripts
elsewhere.

Hence, should I be able to integrate mod_perl to my secure web server, I
still would need to receive perl requests through mod_perl only, but rather
than executing the scripts there itself, I should instruct mod_perl to
delegate the interpretation/execution of perl scripts to elsewhere.

This being the requirement, I planned to proceed this way -
1. I would modify mod_perl code to forward a perl request to another
standalone server.  This I planned to do with sockets (rather than employing
Queues, files etc.) since, I would need persistent connections to serve
dynamic perl scripts.

2. I should look for a server that could communicate with mod_perl.  
This
server would execute the perl scripts and return the response back to
mod_perl.  This I call the standalone server.

I will probe all the suggestions you all had sent me.

I shall look for at the POE mail lists.

with thanks
rsr.

-Original Message-
From: Perrin Harkins [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 10:08 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Query


Chandrasekhar R S wrote:
 I am having a requirement as follows :

   I need to execute/interpret the perl requests away from mod_perl.

Can you explain why you want to do this?  Your stated requirement is
already met by CGI, FastCGI, SpeedyCGI, and a bunch of other things, but
we can't really recommend anything specific without more information.

- Perrin




Re: sesion managing

2003-01-07 Thread Enrico Sorcinelli
On Mon, 30 Dec 2002 09:46:41 +
koudjo ametepe [EMAIL PROTECTED] wrote:

 hi everbody ,
 How do you do
 I developping an intranet project with perl and Mysql .
 I encounter a problem and still i haven't found a solution .The problem is
 previously i was using php/mysql ; with the function sesssion_xxx i was able to keep 
user id through all the pages and store it any time that the user save something in 
the database .
 Umfortunately i don't know how to do this with perl , i read some articles on the 
net about it but i get nothing.
 Please can you give me some ideas about the session managing in perl/mysql
 thanks
 koudjo

Hi,
if you use mod_perl, you can look at:

http://search.cpan.org/author/ENRYS/Apache-SessionManager-0.04/

a mod_perl extensions that manage sessions tansparently for you.
It uses Apache::Session::* modules as persistence framework for session data.
Then you can use all datastores supported by Apache::Session (file, MySQL, Postgres,
Sybase, Oracle, DB_File, RAM, PHP-like file)

Bye

- Enrico Sorcinelli





RE: [OT] Query

2003-01-07 Thread Rob Bloodgood
   I would like to know any such standalone servers that could
 process the perl requests offline (taking requests from a file or
 queue end).

   I definitely would like to get fancier as my requirement is
 immediate.  Upon finding a server that could process the requests
 away from mod_perl, I most probably would modify mod_perl to
 communicate with the standalone servers via sockets (and maybe
 maintain persistence).

Well, I had a need like this, and I wrote a standalone server that my
mod_perl processes communicate with, using POE (http://poe.perl.org).  My
POE server has, among other features, a TCP line-based interface.  I can
test it with a simple telnet, or using netcat(1).  It meets my needs, but be
advised that this server itself had (has!) a pretty substantial development
time investment involved as well... and that is aside from simply learning
how to make things work in POE!

However, by no means should you consider POE your only opportunity... there
are any number of ways to write a server daemon that can communicate with
another process via TCP or pipe or whatever.

That being said, this thread is now completely aside from mod_perl, and I
agree it should terminate.  But if you decide to pursue POE, then I'll see
you on the POE list!

L8r,
Rob