Re: Apache::Registry in mod_perl 2

2003-07-17 Thread ColinB

--- Stas Bekman <[EMAIL PROTECTED]> wrote:
> ColinB wrote:
> > So how can I go about installing just Apache::Registry from the
> > mod_perl 1 tar file without having to install ALL of mod_perl 1 ?
> 
> simply copy it into one of the dirs in your @INC.
> 
> You will also need to load Apache::compat for it to work.
> 

Thanks. I've untarred mod_perl 1.0 and searched for any Registry*
filnames:

./lib/Apache/RegistryBB.pm
./lib/Apache/RegistryNG.pm
./lib/Apache/Registry.pm
./lib/Apache/RegistryLoader.pm

Do I need to copy ALL of these files (and maybe others?) or just the
"./lib/Apache/Registry.pm"  file?




__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com


Re: Apache::Registry in mod_perl 2

2003-07-17 Thread Stas Bekman
[please don't take the threads off the list]

ColinB wrote:
--- Stas Bekman <[EMAIL PROTECTED]> wrote:

ColinB wrote:

So how can I go about installing just Apache::Registry from the
mod_perl 1 tar file without having to install ALL of mod_perl 1 ?
simply copy it into one of the dirs in your @INC.

You will also need to load Apache::compat for it to work.



Thanks. I've untarred mod_perl 1.0 and searched for any Registry*
filnames:
./lib/Apache/RegistryBB.pm
./lib/Apache/RegistryNG.pm
./lib/Apache/Registry.pm
./lib/Apache/RegistryLoader.pm
Do I need to copy ALL of these files (and maybe others?) or just the
"./lib/Apache/Registry.pm"  file?
If you are going to use only Apache::Registry you only need to copy
lib/Apache/Registry.pm
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Help me understand mod_perl and Environment settings

2003-07-17 Thread Bernhard Donaubauer
Hello!

I just startet learning mod_perl and apache. I use the current version of 
mod_perl 1 and apache 1.3. Perl itself has version 6.5.1.

My aim ist to set some environment variables visible to all apache/perl 
children (as far as I unsterstand there is one perl instance for each apache 
child), but my testapplication does sometimes see my environment settings and 
sometimes not. It changes if I press the refresh button of the browser.

According to mod_perl Developerls Cookbook I createt a script called 
envteststartup.pl:
  1 #!/usr/bin/env perl
  2
  3 BEGIN{
  4 $ENV{ORACLE_HOME}="/opt/oracle/product/9.2.0";
  5 $ENV{ORACLE_SID}="i001";
  6 $ENV{ORACLE_TERM}="xterm";
  7 $ENV{NLS_LANG}="AMERICAN_AMERICA.WE8ISO8859P1";
  8 
$ENV{ORA_NLS33}="/opt/oracle/product/9.2.0/ocommon/nls/admin/data";
  9 $ENV{NLS_TIMESTAMP_FORMAT}="-MM-DD HH24:MI:SS.FF";
 10 $ENV{NLS_TIMESTAMP_TZ_FORMAT}="-MM-DD HH24:MI:SS.FF TZR";
 11 $ENV{NLS_DATE_FORMAT}="-MM-DD";
 12 $ENV{NLS_NUMERIC_CHARACTERS}=",.";
 13 $ENV{TNS_ADMIN}="/opt/oracle/product/9.2.0/network/admin";
 14
 15 $ENV{INFORMIXDIR}="/opt/informix";
 16 $ENV{INFORMIXSERVER}="onltuxtcp";
 17 $ENV{DBDATE}="Y4MD-";
 18 $ENV{DBCENTURY}="C";
 19
 20 $ENV{BETLOGDIR}="/usr/local/apache/logs";
 21 $ENV{BETYUCDB}="yucatan_test1";
 22 $ENV{BETYUCDBTYP}="informix";
 23 $ENV{BETLOGIN}="login";
 24
 25 $ENV{SESSIONDIR}="/usr/local/apache/sessions";
 26 $ENV{SESSIONLOCKDIR}="/usr/local/apache/sessions/lock";
 27 }
 28
 29 use lib qw(/usr/local/apache/modperlappl);
 30 use lib qw(/usr/local/apache);
 31
 32 use strict;
 33 use warnings;
 34 use Apache::DBI;
 35 use DBI;
 36 use Apache::Session;
 37 use Apache::Session::File;
 38 use Apache::Request;
 39 use Apache::URI;
 40 use Apache::Log;
 41
 42 use envtest::handler;
 43
 44 1;

My http.conf has the following mod_perl entries:
338 PerlRequire conf/envteststartup.pl
339
340 Alias /envtest/ /usr/local/apache/modperlappl/envtest/
341 
342 SetHandler perl-script
343 PerlHandler envtest::handler
344 

My testapplication is as simple as can be:
  1 package envtest::handler;
  2
  3 sub handler {
  4 my $r=Apache::Request->instance(shift());
  5
  6 $r->send_http_header('text/plain');
  7
  8 print "Environment:\n";
  9
 10 while ( my ( $key, $value ) = each %ENV ) {
 11 print "$key: $value\n";
 12 }
 13
 14 }
 15
 16 1;

I assume not all perl instances get my environment settings but where is the 
error causing me headache?

Regards,
Bernhard Donaubauer


Re: Double erroneous requests in POST with multipart/form-data

2003-07-17 Thread Stas Bekman
Mark Maunder wrote:
I'm running all scripts under Apache::Registry and using Apache::Request
because I'm handling file uploads. Sorry, should have included that. 

I did test this: I modified the Apache::Registry script that was being
posted to so that it didn't create an Apache::Registry request object,
but simply did a print "Content-type: text/html\n\nTesting123\n"; And I
got the same double request problem.  So it seems that it's Apache not
liking that particular request for some reason. 

Here's something wierd. I telnetted to my server's port 80 and pasted
the request, and it didn't reproduce the problem. 
Try using the command line user agent, e.g. lwp, lynx or else, where you can 
control the involvement of the user agent. For example you can see response 
headers, which probably aren't available under IE.

[...]

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: modperl2 Apache::HTTP_FORBIDDEN and Apache::HTTP_INTERNAL_SERVER_ERRORimplemented?

2003-07-17 Thread Stas Bekman
speeves wrote:
Hi!

Just wondering if Apache::HTTP_FORBIDDEN and 
Apache::HTTP_INTERNAL_SERVER_ERROR have been implemented?  I have been 
trying to port Apache::AuthenNTLM, and keep getting:

[Tue Jul 15 16:46:08 2003] [error] failed to resolve handler 
`Apache::AuthenNTLM'
[Tue Jul 15 16:46:08 2003] [error] [client 192.168.1.2] Bareword 
"Apache::HTTP_FORBIDDEN" not allowed while "strict subs" in u
se at /usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm line 593.
Bareword "Apache::HTTP_INTERNAL_SERVER_ERROR" not allowed while "strict 
subs" in use at /usr/local/lib/perl/5.6.1/Apache/Authe
nNTLM.pm line 597.
Bareword "Apache::HTTP_INTERNAL_SERVER_ERROR" not allowed while "strict 
subs" in use at /usr/local/lib/perl/5.6.1/Apache/Authe
nNTLM.pm line 632.
BEGIN not safe after errors--compilation aborted at 
/usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm line 671.
Compilation failed in require at (eval 10) line 3.

in the error_log.  I have other constants that are imported from 
Apache::Const, so do not think that it is a problem with scope...  Here 
is the code:

line 593 --  return $self->{ntlmauthoritative} ? (defined($nonce) ? (MP2 
? Apache::HTTP_FORBIDDEN : Apache::Constants::HTTP_
FORBIDDEN) : (MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : 
Apache::Constants::HTTP_INTERNAL_SERVER_ERROR)) : (MP2 ? Apache::DE
CLINED : Apache::Constants::DECLINED) ;

and

line 632 --- # return MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : 
Apache::Constants::HTTP_INTERNAL_SERVER_ERROR ;

If you need more, let me know.
Have you imported them?

use Apache::Const compile ->qw(Apache::HTTP_FORBIDDEN);

All the available Apache:: constants are listed here:

http://perl.apache.org/docs/2.0/api/Apache/Const.html



__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: PerlOptions +Parent without ithreads

2003-07-17 Thread Stas Bekman
Stuart Johnston wrote:
I am trying to setup Virtual Hosts each with their own Perl interpreter. 
 I found the "PerlOptions +Parent" configuration but that requires 
ithreads.  Is there another similar option I should look at that does 
not requre ithread?
No. Perl interpreter pools are possible only with threads.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Help me understand mod_perl and Environment settings

2003-07-17 Thread Mike P. Mikhailov
Hello Bernhard Donaubauer,

Thursday, July 17, 2003, 5:34:57 PM, you wrote:

BD> Hello!

BD> I just startet learning mod_perl and apache. I use the current version of 
BD> mod_perl 1 and apache 1.3. Perl itself has version 6.5.1.

BD> My aim ist to set some environment variables visible to all apache/perl 
BD> children (as far as I unsterstand there is one perl instance for each apache 
BD> child), but my testapplication does sometimes see my environment settings and 
BD> sometimes not. It changes if I press the refresh button of the browser.

http://perl.apache.org/docs/1.0/guide/porting.html#Sometimes_it_Works__Sometimes_it_Doesn_t

BD> According to mod_perl Developerls Cookbook I createt a script called 
BD> envteststartup.pl:
BD>   1 #!/usr/bin/env perl
BD>   2
BD>   3 BEGIN{
BD>   4 $ENV{ORACLE_HOME}="/opt/oracle/product/9.2.0";
BD>   5 $ENV{ORACLE_SID}="i001";
BD>   6 $ENV{ORACLE_TERM}="xterm";
BD>   7 $ENV{NLS_LANG}="AMERICAN_AMERICA.WE8ISO8859P1";

http://perl.apache.org/docs/1.0/guide/porting.html#BEGIN_blocks

BD>   8 
BD> $ENV{ORA_NLS33}="/opt/oracle/product/9.2.0/ocommon/nls/admin/data";
BD>   9 $ENV{NLS_TIMESTAMP_FORMAT}="-MM-DD HH24:MI:SS.FF";
BD>  10 $ENV{NLS_TIMESTAMP_TZ_FORMAT}="-MM-DD HH24:MI:SS.FF TZR";
BD>  11 $ENV{NLS_DATE_FORMAT}="-MM-DD";
BD>  12 $ENV{NLS_NUMERIC_CHARACTERS}=",.";
BD>  13 $ENV{TNS_ADMIN}="/opt/oracle/product/9.2.0/network/admin";
BD>  14
BD>  15 $ENV{INFORMIXDIR}="/opt/informix";
BD>  16 $ENV{INFORMIXSERVER}="onltuxtcp";
BD>  17 $ENV{DBDATE}="Y4MD-";
BD>  18 $ENV{DBCENTURY}="C";
BD>  19
BD>  20 $ENV{BETLOGDIR}="/usr/local/apache/logs";
BD>  21 $ENV{BETYUCDB}="yucatan_test1";
BD>  22 $ENV{BETYUCDBTYP}="informix";
BD>  23 $ENV{BETLOGIN}="login";
BD>  24
BD>  25 $ENV{SESSIONDIR}="/usr/local/apache/sessions";
BD>  26 $ENV{SESSIONLOCKDIR}="/usr/local/apache/sessions/lock";
BD>  27 }
BD>  28
BD>  29 use lib qw(/usr/local/apache/modperlappl);
BD>  30 use lib qw(/usr/local/apache);
BD>  31
BD>  32 use strict;
BD>  33 use warnings;
BD>  34 use Apache::DBI;
BD>  35 use DBI;
BD>  36 use Apache::Session;
BD>  37 use Apache::Session::File;
BD>  38 use Apache::Request;
BD>  39 use Apache::URI;
BD>  40 use Apache::Log;
BD>  41
BD>  42 use envtest::handler;
BD>  43
BD>  44 1;

BD> My http.conf has the following mod_perl entries:
BD> 338 PerlRequire conf/envteststartup.pl
BD> 339
BD> 340 Alias /envtest/ /usr/local/apache/modperlappl/envtest/
BD> 341 
BD> 342 SetHandler perl-script
BD> 343 PerlHandler envtest::handler
BD> 344 

BD> My testapplication is as simple as can be:
BD>   1 package envtest::handler;
BD>   2
BD>   3 sub handler {
BD>   4 my $r=Apache::Request->instance(shift());
BD>   5
BD>   6 $r->send_http_header('text/plain');
BD>   7
BD>   8 print "Environment:\n";
BD>   9
BD>  10 while ( my ( $key, $value ) = each %ENV ) {
BD>  11 print "$key: $value\n";
BD>  12 }
BD>  13
BD>  14 }
BD>  15
BD>  16 1;

BD> I assume not all perl instances get my environment settings but where is the 
BD> error causing me headache?

BD> Regards,
BD> Bernhard Donaubauer

Also see
http://perl.apache.org/docs/1.0/guide/config.html#PerlSetEnv_and_PerlPassEnv
http://perl.apache.org/docs/1.0/guide/config.html#PerlSetVar_and_PerlAddVar
http://perl.apache.org/docs/1.0/guide/config.html#PerlSetupEnv

Hope this will help.

-- 
WBR, Mike P. Mikhailov

mailto: [EMAIL PROTECTED]
ICQ:280990142



Re: modperl2 Apache::HTTP_FORBIDDEN and Apache::HTTP_INTERNAL_SERVER_ERRORimplemented?

2003-07-17 Thread Shannon Eric Peevey
Stas Bekman wrote:

speeves wrote:

Hi!

Just wondering if Apache::HTTP_FORBIDDEN and 
Apache::HTTP_INTERNAL_SERVER_ERROR have been implemented?  I have 
been trying to port Apache::AuthenNTLM, and keep getting:

[Tue Jul 15 16:46:08 2003] [error] failed to resolve handler 
`Apache::AuthenNTLM'
[Tue Jul 15 16:46:08 2003] [error] [client 192.168.1.2] Bareword 
"Apache::HTTP_FORBIDDEN" not allowed while "strict subs" in u
se at /usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm line 593.
Bareword "Apache::HTTP_INTERNAL_SERVER_ERROR" not allowed while 
"strict subs" in use at /usr/local/lib/perl/5.6.1/Apache/Authe
nNTLM.pm line 597.
Bareword "Apache::HTTP_INTERNAL_SERVER_ERROR" not allowed while 
"strict subs" in use at /usr/local/lib/perl/5.6.1/Apache/Authe
nNTLM.pm line 632.
BEGIN not safe after errors--compilation aborted at 
/usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm line 671.
Compilation failed in require at (eval 10) line 3.

in the error_log.  I have other constants that are imported from 
Apache::Const, so do not think that it is a problem with scope...  
Here is the code:

line 593 --  return $self->{ntlmauthoritative} ? (defined($nonce) ? 
(MP2 ? Apache::HTTP_FORBIDDEN : Apache::Constants::HTTP_
FORBIDDEN) : (MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : 
Apache::Constants::HTTP_INTERNAL_SERVER_ERROR)) : (MP2 ? Apache::DE
CLINED : Apache::Constants::DECLINED) ;

and

line 632 --- # return MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : 
Apache::Constants::HTTP_INTERNAL_SERVER_ERROR ;

If you need more, let me know.


Have you imported them?

use Apache::Const compile ->qw(Apache::HTTP_FORBIDDEN);

All the available Apache:: constants are listed here:

http://perl.apache.org/docs/2.0/api/Apache/Const.html

Yeah, unfortunately... :(   Though I seem to be chasing it down to a 
possible problem with the method handler:

sub handler ($$)

But even with a change to:

sub handler : method

I'm still not able to access the imported CONSTANTS 
This is definitely the most complex port that I've done, so is taking me 
a little while to find all of the buggies...   Will keep you posted :)

speeves
cws


mod_per2/PerlInc in Virtualhost

2003-07-17 Thread Thomas Schindl
Hi,

Is it possible to use different PerlINC-Paths in different virtual hosts
in mod_perl2. In mod_perl1 I've used Apache::PerlVINC what do I use in
mod_perl2?

thx

tom



Re: How to share subroutine

2003-07-17 Thread Thomas Klausner
:Hi!

On Wed, Jul 16, 2003 at 10:46:27PM +0100, Ged Haywood wrote:
> Hi there,
> 
> On Wed, 16 Jul 2003, Matthew Wu wrote:
> 
> >I put all my subroutine in file.pm, what I need to do such that it
> > can be used by my program? I don't what location I need to put it in and
> > what kind of configuration I need to modify. I am running Redhat 6.3.
> 
> At the risk of repetition... :)

Ha! :-)

> This is a mailing List specifically for mod_perl issues.
> Are you using mod_perl?

If you're using mod_perl, you might find this helpful:
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#userequiredo_INC_and__INC_Explained
and
http://perl.apache.org/docs/1.0/guide/config.html#The_Startup_File

especially:
  use lib qw(/path/to/module);

But, as Ged allready mentioned, please RTFM! The mod_perl docs are really
great, so please DO read them.

http://perl.apache.org


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


Another newbie question: SetPerlVar

2003-07-17 Thread Walter H. van Holst
Hello,
 
 If I use SetPerlVar in my apache-perl httpd.conf by just plainly
stating.

SetPerlVar Foo Bar

Apache-perl won't start:

Syntax error on line xxx of /etc/apache-perl/httpd.conf:
Invalid command 'SetPerlVar', perhaps mis-spelled or defined by a module
not included in the server configuration
/usr/sbin/apache-perl-ctl start: httpd could not be started

What is the obvious thing I am overlooking?

Regards,

 Walter
-- 
Like almost everyone, I receive a lot of spam every day, much of it
offering to help me get out of debt or get rich quick. It's ridiculous.
(Bill Gates)



Re: Another newbie question: SetPerlVar

2003-07-17 Thread Haroon Rafique
On Today at 6:47pm, WHvH=>Walter H. van Holst <[EMAIL PROTECTED]>...:

WHvH> Hello,
WHvH>  
WHvH>  If I use SetPerlVar in my apache-perl httpd.conf by just plainly
WHvH> stating.
WHvH> 
WHvH> SetPerlVar Foo Bar
WHvH> 

Try PerlSetVar instead.

For 1.0
http://perl.apache.org/docs/1.0/guide/config.html#PerlSetVar_and_PerlAddVar

For 2.0
http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlSetVar_

--
Haroon Rafique
<[EMAIL PROTECTED]>



Re: Double erroneous requests in POST with multipart/form-data

2003-07-17 Thread Mark Maunder
Thanks for all the feedback. This problem is strange in that I haven't
been able to duplicate it. IE got itself in a wierd situation where I
would hit Reload (and press OK to confirm a rePOST) and the problem
would consistently occur. Once I took IE out of that loop, I couldn't
duplicate it. 

The thing that bugged me is that when I google'd it I found a few other
people who had the same problem with POSTed multipart data. So I suspect
it's just some IE strangeness that causes the 'boundary' spec in the
header to be malformed in some circumstances and causes Apache to think
it's two pipelined requests, the second one which is asking for '/'.

I'll re-post if I come up with anything useful or am able to reproduce
this.

On Thu, 2003-07-17 at 04:39, Stas Bekman wrote:
> Mark Maunder wrote:
> > I'm running all scripts under Apache::Registry and using Apache::Request
> > because I'm handling file uploads. Sorry, should have included that. 
> > 
> > I did test this: I modified the Apache::Registry script that was being
> > posted to so that it didn't create an Apache::Registry request object,
> > but simply did a print "Content-type: text/html\n\nTesting123\n"; And I
> > got the same double request problem.  So it seems that it's Apache not
> > liking that particular request for some reason. 
> > 
> > Here's something wierd. I telnetted to my server's port 80 and pasted
> > the request, and it didn't reproduce the problem. 
> 
> Try using the command line user agent, e.g. lwp, lynx or else, where you can 
> control the involvement of the user agent. For example you can see response 
> headers, which probably aren't available under IE.
> 
> [...]
> 
> __
> Stas BekmanJAm_pH --> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
-- 
Mark Maunder <[EMAIL PROTECTED]>
ZipTree Inc.



Re: Another newbie question: SetPerlVar

2003-07-17 Thread Frank Wiles
On 17 Jul 2003 18:47:06 +0200
"Walter H. van Holst" <[EMAIL PROTECTED]> wrote:

> Hello,
>  
>  If I use SetPerlVar in my apache-perl httpd.conf by just plainly
> stating.
> 
> SetPerlVar Foo Bar
> 
> Apache-perl won't start:
> 
> Syntax error on line xxx of /etc/apache-perl/httpd.conf:
> Invalid command 'SetPerlVar', perhaps mis-spelled or defined by a
> module not included in the server configuration
> /usr/sbin/apache-perl-ctl start: httpd could not be started
> 
> What is the obvious thing I am overlooking?

  It's PerlSetVar not SetPerlVar. 

 -
   Frank Wiles <[EMAIL PROTECTED]>
   http://frank.wiles.org
 -



Re: modperl2 Apache::HTTP_FORBIDDEN... [long post]

2003-07-17 Thread Shannon Eric Peevey
Have you imported them?

use Apache::Const compile ->qw(Apache::HTTP_FORBIDDEN);

All the available Apache:: constants are listed here:

http://perl.apache.org/docs/2.0/api/Apache/Const.html



Hi!

I have included the bare minimum of the code from the module, 
(Apache::AuthenNTLM).  It is still  acting as if I have not imported the 
modules, but I have changed "require" to "use", moved the "use" 
statements into various places of the module to see if they would catch 
it, and nothing doing...  I am at the end of my wits.  If someone would 
have a minute to see if they can see why the Constants within the "sub 
handler" would not be found, (though they are imported), that would be a 
great thanks and help :)  I am running apache 2.0.46 and mod_perl 
1.99_09, perl 5.6.1 on a Debian machine.

Thanks in advance,
speeves
cws
package Apache::AuthenNTLM ;

use strict ;
use vars qw{$cache $VERSION %msgflags1 %msgflags2 %msgflags3 %invflags1 
%invflags2 %invflags3 $debug} ;
use warnings ;
no warnings 'redefine';

$VERSION = 0.24 ;

$debug = 0 ;

$cache = undef ;

use MIME::Base64 () ;
use Authen::Smb 0.95 ;
use Socket ;

# here is where we start the new code

use mod_perl ;
# use Apache::Constants qw(:common);
# setting the constants to help identify which version of mod_perl
# is installed
use constant MP2 => ($mod_perl::VERSION >= 1.99);
# test for the version of mod_perl, and use the appropriate libraries
BEGIN {
   if (MP2) {
   require Apache::Const;
   require Apache::Access;
   require Apache::Connection;
   require Apache::Log;
   require Apache::RequestRec;
   require Apache::RequestUtil;
   apache::Const->import(-compile => 
'HTTP_UNAUTHORIZED','HTTP_INTERNAL_SERVER_ERROR','DECLINED','HTTP_FORBIDDEN','OK');
   } else {
   require Apache::Constants;
   
Apache::Constants->import('HTTP_UNAUTHORIZED','HTTP_INTERNAL_SERVER_ERROR','DECLINED','HTTP_FORBIDDEN','OK');
   }
}
# end modperl code ##



sub handler : method # ($$)
   {
   my ($class, $r) = @_ ;
   my $type ;
   my $nonce = '' ;
   my $self ;
   my $conn = $r -> connection ;
   my $connhdr =  $r -> header_in ('Connection') ;
   my $fh = select (STDERR) ;
   $| = 1 ;
   select ($fh) ;
   my ($addr, $port) = sockaddr_in ($conn -> remote_addr) ;

   print STDERR "[$$] AuthenNTLM: Start NTLM Authen handler pid = $$, 
connection = $$conn conn_http_hdr = $connhdr  main = " . ($r -> main) . 
" cuser = " . $conn -> user .
   ' remote_ip = ' . $conn -> remote_ip . " remote_port 
= " . unpack('n', $port) . ' remote_host = <' . $conn -> remote_host . 
"> version = $VERSION\n" if ($debug) ;

   # we cannot attach our object to the connection record. Since in
   # Apache 1.3 there is only one connection at a time per process
   # we can cache our object and check if the connection has changed.
   # The check is done by slightly changing the remote_host member, which
   # persists as long as the connection does
   # This has to be reworked to work with Apache 2.0
   if (ref ($cache) ne $class || $$conn != $cache -> {connectionid} || 
$conn -> remote_host ne $cache->{remote_host})
   {
   $conn -> remote_host ($conn -> remote_host . ' ') ;
   $self = {connectionid => $$conn, remote_host => $conn -> 
remote_host} ;
   bless $self, $class ;
   $cache = $self ;
   print STDERR "[$$] AuthenNTLM: Setup new object\n" if ($debug) ;
   }
   else
   {
   $self = $cache ;
   print STDERR "[$$] AuthenNTLM: Object exists user = 
$self->{userdomain}\\$self->{username}\n" if ($debug) ;

   if ($self -> {ok})
   {
   $conn -> user($self->{mappedusername}) ;
   # we accept the user because we are on the same connection
   $type = $self -> get_msg ($r);
   my $content_len = $r -> header_in('content-length') ;
   my $method  = $r -> method ;
   print STDERR "[$$] AuthenNTLM: Same connection pid = $$, 
connection = $$conn cuser = " .
   $conn -> user . ' ip = ' . $conn -> 
remote_ip . ' method = ' . $method . ' Content-Length = ' .
   $content_len . ' type = ' . $type . "\n" 
if ($debug) ;

   # IE (5.5, 6.0, probably others) can send a type 1 message
   # after authenticating on the same connection.  This is a
   # problem for POST messages, because IE also sends a
   # "Content-length: 0" with no POST data.
   if ($method eq 'GET' || $method eq 'HEAD' || $method eq 
'OPTION' || $method eq 'DELETE' ||
   $content_len > 0 || $type == 3)
   {
   print STDERR "[$$] AuthenNTLM: OK because same 
connection\n" if ($debug) ;
   return MP2 ? Apache::OK : Apache::Constants::OK ;
  

Re: Another newbie question: SetPerlVar

2003-07-17 Thread Walter H. van Holst
On Thu, 2003-07-17 at 18:56, Frank Wiles wrote:

> > What is the obvious thing I am overlooking?
> 
>   It's PerlSetVar not SetPerlVar. 

* Blush *

Thanks.

Regards,

 Walter
-- 
All things that are, are with more spirit chased than enjoyed.
 -- Shakespeare, "Merchant of Venice"



mod_perl and perl version

2003-07-17 Thread Andy Harrison
-BEGIN PGP SIGNED MESSAGE-

I'm installing RT 3.0.4 on a fresh server and I'm getting tripped up installing
mod_perl.  What I'm worried about is if I install mod_perl against perl 5.8.0,
will all scripts that get run on apache be executed using perl version 5.8.0? 
Or can I lock that down to a specific vhost?  There's a series of perl scripts
in a different vhost than rt that are written for an older version of perl and I
don't want them to be affected by the mod_perl installation.



~~ 
Andy Harrison
Great Works Internet
System Operations
(full headers for details)

-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPxblWFPEkLgodAWVAQGQJgP+NeEhKjpGA7cSOamSPVAqUQuCmHJYra9Z
8ekkgx1ySa7us73LervrgMEDOjnbx5OrVCvCVQHRowPMSM0AxQokeCVqHtiKG9pp
JvQ8sC9Dmizm5D2MvWk45mLTplkq8x2LcUCaOnJJK2VPT73DPQ+gU3i0vYxeL7Ne
73WRhJP8cuU=
=r16+
-END PGP SIGNATURE-


Re: mod_perl and perl version

2003-07-17 Thread Perrin Harkins
On Thu, 2003-07-17 at 14:05, Andy Harrison wrote:
> I'm installing RT 3.0.4 on a fresh server and I'm getting tripped up installing
> mod_perl.  What I'm worried about is if I install mod_perl against perl 5.8.0,
> will all scripts that get run on apache be executed using perl version 5.8.0?

All scripts that run under mod_perl will be executed using the perl that
you built it against.  Scripts run under CGI can still be set to use
different perl executables.

- Perrin


Re: mod_perl and perl version

2003-07-17 Thread Andy Harrison
-BEGIN PGP SIGNED MESSAGE-


~
On 17-Jul-2003, Perrin Harkins wrote message "Re: mod_perl and perl version"
~
> 
> All scripts that run under mod_perl will be executed using the perl that
> you built it against.  Scripts run under CGI can still be set to use
> different perl executables.
> 
> - Perrin


Ok, so since my rt vhost has these lines:

 PerlModule Apache::DBI
 PerlRequire /usr/local/rt3/bin/webmux.pl

 
 SetHandler perl-script
 PerlHandler RT::Mason
 

Will they be the only vhost to use mod perl?  The other vhosts simply have
Directory directives with ExecCGI turned on.

~~ 
Andy Harrison

-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPxbnvFPEkLgodAWVAQFtNgP9GSDfzRKqk4nFOVQXcw0AIWeOxQSJrHcK
S1+WcwobgdwKACDfRTJ9nEf8W2l08xNVEDpRoNsbq/XiKdCO7fUR3z17R1RfhnvZ
qUoS/hng0WbdpoMLYilrf98Mn+JWJNl/dR2US5G+EBCLplPRQXWdX7WbEMk5VKFP
LddNWXVdsc4=
=wN2S
-END PGP SIGNATURE-


Re: mod_perl and perl version

2003-07-17 Thread Perrin Harkins
On Thu, 2003-07-17 at 14:15, Andy Harrison wrote:
> Ok, so since my rt vhost has these lines:
> 
>  PerlModule Apache::DBI
>  PerlRequire /usr/local/rt3/bin/webmux.pl
> 
>  
>  SetHandler perl-script
>  PerlHandler RT::Mason
>  
> 
> Will they be the only vhost to use mod perl?  The other vhosts simply have
> Directory directives with ExecCGI turned on.

If that's the only place you have "PerlHandler" in your httpd.conf, then
only RT will use mod_perl.

- Perrin


does pnotes() work at all in 1.27?

2003-07-17 Thread Mark Maunder
Sorry about the repost, but this is driving me nuts.

Has anyone gotten $r->pnotes() to work under Apache 1.3.27 and mod_perl
1.27? A simple yes will do because then at least I'll know if it's my
mistake or a bug. 

It's this posting that makes me think it's a bug:
http://groups.yahoo.com/group/modperl/message/45472





clones and parents

2003-07-17 Thread Marc M. Adkins
Let's say I want to create a site with five virtual hosts.  I want all of
them to share the basic MP2 stuff, Apache-related modules and so forth.
Then, for Virtual Host 1 (VH1 for short ;) I want to specify a set of
modules unique to VH1.  For VH2-VH4 I want to specify another set of
modules, but the same set for all of those virtual hosts.

So I feel like I want to have two interpreter pools.  I want a parent at the
top-most level (outside of all of the virtual hosts) that loads the basic
stuff.  Then I want a parent and a pool for VH1.  Then I want a parent and a
pool for VH2-VH4 to share.

I'm not clear on how to do this or even if it is possible.  I understand how
the Clone and Parent options work, but they depend on the structure of the
Apache configuration file.  I don't offhand know of a way to group four
virtual hosts into a block so that they can inherit the same parent/pool.

If I were trying to solve this (assuming that it isn't already possible
somehow) I might come up with the concept of named interpreter parent/pools.
Something like:


  PerlRequire "VH1/startup.pl"
  ...




  PerlRequire "VHX/startup.pl"
  ...



  PerlInterpPoolVH1



  PerlInterpPoolVHX


...


  PerlInterpPoolVHX


But that's just off the top of my head and probably wrong for any number of
reasons.

Any thoughts?  Or better yet, a way to do this with MP2 already?

mma



Re: modperl2 Apache::HTTP_FORBIDDEN... [long post]

2003-07-17 Thread Randy Kobes
On Thu, 17 Jul 2003, Shannon Eric Peevey wrote:

> > Have you imported them?
> > use Apache::Const compile ->qw(Apache::HTTP_FORBIDDEN);
> > All the available Apache:: constants are listed here:
> > http://perl.apache.org/docs/2.0/api/Apache/Const.html
>
> I have included the bare minimum of the code from the module,
> (Apache::AuthenNTLM).  It is still acting as if I have not
> imported the modules, but I have changed "require" to "use",
> moved the "use"  statements into various places of the module
> to see if they would catch it, and nothing doing...  I am at
> the end of my wits.  If someone would have a minute to see if
> they can see why the Constants within the "sub handler" would
> not be found, (though they are imported), that would be a great
> thanks and help :)  I am running apache 2.0.46 and mod_perl
> 1.99_09, perl 5.6.1 on a Debian machine.
>
> package Apache::AuthenNTLM ;
[ .. ]
> use constant MP2 => ($mod_perl::VERSION >= 1.99);
>
> # test for the version of mod_perl, and use the appropriate libraries
> BEGIN {
> if (MP2) {
> require Apache::Const;
> require Apache::Access;
> require Apache::Connection;
> require Apache::Log;
> require Apache::RequestRec;
> require Apache::RequestUtil;
> apache::Const->import(-compile =>
  ^
This might be a typo, but if you change that to Apache::Const
(upper case 'A'), does that help?

-- 
best regards,
randy kobes


Re: does pnotes() work at all in 1.27?

2003-07-17 Thread Dennis Stout
> Has anyone gotten $r->pnotes() to work under Apache 1.3.27 and mod_perl
> 1.27? A simple yes will do because then at least I'll know if it's my
> mistake or a bug.

I'll work on it when I get home again.  weee, thursday, gotta have this
project done monday..  *sigh*

The good news, is that I run Apache 1.3.27 and mod_perl 1.27.

Anyways, thought you might like to know I'll work on it and someone out there
HAS read your email :)

Dennis



Re: does pnotes() work at all in 1.27?

2003-07-17 Thread Mark Maunder
Thanks - would be helpful if you could try to use pnotes to communicate
between two mod_perl handlers. Just some really basic code like:
package MyContentHandler;
use Apache::Constants qw( :common );
sub handler
{
my $r = shift @_;
$r->pnotes('mykey', 'A regular string scalar');
$r->send_header('text/html');
print "Hi there. This is a regular content handler.";
return OK;
}
1;

and 
package MyLoggingHandler;
use Apache::Constants qw( :common );
sub handler
{
my $r = shift @_;
#Do some logging
warn "Value of pnotes is: " . $r->pnotes('mykey');
return OK;
}
1;

And then install those as a content and logging phase handler. If you
have the time and the interest. I've tried this and the logging handler
comes up with nothing in pnotes. I've also checked that it's not a sub
request. Thanks :)

On Thu, 2003-07-17 at 12:44, Dennis Stout wrote:
> > Has anyone gotten $r->pnotes() to work under Apache 1.3.27 and mod_perl
> > 1.27? A simple yes will do because then at least I'll know if it's my
> > mistake or a bug.
> 
> I'll work on it when I get home again.  weee, thursday, gotta have this
> project done monday..  *sigh*
> 
> The good news, is that I run Apache 1.3.27 and mod_perl 1.27.
> 
> Anyways, thought you might like to know I'll work on it and someone out there
> HAS read your email :)
> 
> Dennis
-- 
Mark Maunder <[EMAIL PROTECTED]>
ZipTree Inc.



Re: does pnotes() work at all in 1.27?

2003-07-17 Thread Mark Maunder
(That's supposed to be send_http_header() - and there's prob a few other
errors in there. :)

On Thu, 2003-07-17 at 13:50, Mark Maunder wrote:
> Thanks - would be helpful if you could try to use pnotes to communicate
> between two mod_perl handlers. Just some really basic code like:
> package MyContentHandler;
> use Apache::Constants qw( :common );
> sub handler
> {
>   my $r = shift @_;
>   $r->pnotes('mykey', 'A regular string scalar');
>   $r->send_header('text/html');
>   print "Hi there. This is a regular content handler.";
>   return OK;
> }
> 1;
> 
> and 
> package MyLoggingHandler;
> use Apache::Constants qw( :common );
> sub handler
> {
>   my $r = shift @_;
>   #Do some logging
>   warn "Value of pnotes is: " . $r->pnotes('mykey');
>   return OK;
> }
> 1;
> 
> And then install those as a content and logging phase handler. If you
> have the time and the interest. I've tried this and the logging handler
> comes up with nothing in pnotes. I've also checked that it's not a sub
> request. Thanks :)
> 
> On Thu, 2003-07-17 at 12:44, Dennis Stout wrote:
> > > Has anyone gotten $r->pnotes() to work under Apache 1.3.27 and mod_perl
> > > 1.27? A simple yes will do because then at least I'll know if it's my
> > > mistake or a bug.
> > 
> > I'll work on it when I get home again.  weee, thursday, gotta have this
> > project done monday..  *sigh*
> > 
> > The good news, is that I run Apache 1.3.27 and mod_perl 1.27.
> > 
> > Anyways, thought you might like to know I'll work on it and someone out there
> > HAS read your email :)
> > 
> > Dennis
-- 
Mark Maunder <[EMAIL PROTECTED]>
ZipTree Inc.



Re: Help me understand mod_perl and Environment settings

2003-07-17 Thread Ged Haywood
Hi there,

On Thu, 17 Jul 2003, Bernhard Donaubauer wrote:

> I just startet learning mod_perl and apache. I use the current version of 
> mod_perl 1 and apache 1.3. Perl itself has version 6.5.1.

Can you be a little more careful with your version numbers in future?

> but my testapplication does sometimes see my environment settings and 
> sometimes not. It changes if I press the refresh button of the browser.

Please see the mod_perl Guide at

http://perl.apache.org

There are references to the symptoms you see at

http://perl.apache.org/docs/1.0/guide/debug.html#Sometimes_My_Script_Works__Sometimes_It_Does_Not

73,
Ged.



Re: modperl2 Apache::HTTP_FORBIDDEN... [long post]

2003-07-17 Thread Shannon Eric Peevey


use constant MP2 => ($mod_perl::VERSION >= 1.99);

# test for the version of mod_perl, and use the appropriate libraries
BEGIN {
   if (MP2) {
   require Apache::Const;
   require Apache::Access;
   require Apache::Connection;
   require Apache::Log;
   require Apache::RequestRec;
   require Apache::RequestUtil;
   apache::Const->import(-compile =>
   

 ^
This might be a typo, but if you change that to Apache::Const
(upper case 'A'), does that help?
 

Fantastic!!!  I have been staring at all of the wrong code for way too 
long... :P

Thanks for taking the time to find my error :)

I should have a working version by the beginning of next week.

speeves
cws


How do I have a PerlAuthenHandler not popup the login box?

2003-07-17 Thread Jason Fong
I'm making a login system that uses a web form instead of the browser's
popup box to input the username/password.  My problem is that when I use
my authentication script as a PerlAuthenHandler in the .htaccess, it
insists on having the browser show the popup username/password box.  I
tried making a simple handler function that just returns OK, but I still
get the login box.

My guess is that using the PerlAuthenHandler automatically sends a
AUTH_REQUIRED to the browser so that the login box appears.

I found a solution to this by changing the PerlAuthenHandler to a
PerlAccessHandler.  Is this the correct way to avoid the login box?  Or
is there a way for a PerlAuthenHandler to not popup a login box?



Re: How do I have a PerlAuthenHandler not popup the login box?

2003-07-17 Thread Keith Keller
On Thu, Jul 17, 2003 at 06:07:48PM -0700, Jason Fong wrote:
> I'm making a login system that uses a web form instead of the browser's
> popup box to input the username/password.  My problem is that when I use
> my authentication script as a PerlAuthenHandler in the .htaccess, it
> insists on having the browser show the popup username/password box.

Well, that's not really a problem--it's how a PerlAuthenHandler, or
any Apache-based authentication handler, is supposed to work.  If you're
using a web form to authenticate users, you don't need Apache or
mod_perl to also authenticate.

> My guess is that using the PerlAuthenHandler automatically sends a
> AUTH_REQUIRED to the browser so that the login box appears.

The whole point of PerlAuthenHandler is to ask the client to send
a specific HTTP request to the server, which the client usually
does by prompting the user.  So your guess is a pretty good one.

> I found a solution to this by changing the PerlAuthenHandler to a
> PerlAccessHandler.  Is this the correct way to avoid the login box?  Or
> is there a way for a PerlAuthenHandler to not popup a login box?

Depending on what you're trying to do, the correct way to avoid the
login box is to omit the PerlAuthenHandler and the PerlAccessHandler,
but without any specifics on what you're trying to do all anyone can
do is guess.

--keith

-- 
[EMAIL PROTECTED]
alt.os.linux.slackware FAQ:  http://wombat.san-francisco.ca.us/cgi-bin/fom



RE: clones and parents

2003-07-17 Thread Marc M. Adkins
No wonder this seemed familiar.  I wrote pretty much the same memo six weeks
ago.  D'oh!  I've been spending too much time at the keyboard...

So is PerlOptions +Parent working?  Whenever I enable it I get a segfault on
W2K / Ap2.0.46 / mp1.99.10dev.

mma

> -Original Message-
> From: Marc M. Adkins [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 17, 2003 1:17 PM
> To: [EMAIL PROTECTED]
> Subject: clones and parents
>
>
> Let's say I want to create a site with five virtual hosts.  I want all of
> them to share the basic MP2 stuff, Apache-related modules and so forth.
> Then, for Virtual Host 1 (VH1 for short ;) I want to specify a set of
> modules unique to VH1.  For VH2-VH4 I want to specify another set of
> modules, but the same set for all of those virtual hosts.
>
> So I feel like I want to have two interpreter pools.  I want a
> parent at the
> top-most level (outside of all of the virtual hosts) that loads the basic
> stuff.  Then I want a parent and a pool for VH1.  Then I want a
> parent and a
> pool for VH2-VH4 to share.
>
> I'm not clear on how to do this or even if it is possible.  I
> understand how
> the Clone and Parent options work, but they depend on the structure of the
> Apache configuration file.  I don't offhand know of a way to group four
> virtual hosts into a block so that they can inherit the same parent/pool.
>
> If I were trying to solve this (assuming that it isn't already possible
> somehow) I might come up with the concept of named interpreter
> parent/pools.
> Something like:
>
>   
> PerlRequire "VH1/startup.pl"
> ...
>   
>
>
>   
> PerlRequire "VHX/startup.pl"
> ...
>   
>
>   
> PerlInterpPoolVH1
>   
>
>   
> PerlInterpPoolVHX
>   
>
>   ...
>
>   
> PerlInterpPoolVHX
>   
>
> But that's just off the top of my head and probably wrong for any
> number of
> reasons.
>
> Any thoughts?  Or better yet, a way to do this with MP2 already?
>
> mma
>
>



mod_accel redirects

2003-07-17 Thread Philip Mak
Given this server configuration (this is a front-end lightweight
Apache, which uses mod_accel to proxy to a back-end mod_perl Apache):

ServerName www.shoujoai.com
ServerAlias shoujoai.com
AccelPass / http://127.0.0.1:8002/

and given a file called "redir.asp", which contains the following:

<% $Response->Redirect('http://127.0.0.1:8002/mush/'); %>

And given that I issue the following query to the web server:

GET /redir.asp HTTP/1.1
Host: shoujoai.com

and the following response:

Location: http://www.shoujoai.com/mush/

Is there a way to make mod_accel return "shoujoai.com" instead of
"www.shoujoai.com" when it rewrites the location header there? It's
using the default ServerName, instead of the Host header that the
client requested. This causes problems when cookies is set on an
alternative hostname, but the web browser gets redirected to the main
hostname. Is there a way to make it use the Host header when rewriting
an internal redirection URL?


Re: How do I have a PerlAuthenHandler not popup the login box?

2003-07-17 Thread Thomas Klausner
Hi!

On Thu, Jul 17, 2003 at 06:07:48PM -0700, Jason Fong wrote:
> I'm making a login system that uses a web form instead of the browser's
> popup box to input the username/password.  My problem is that when I use
> my authentication script as a PerlAuthenHandler in the .htaccess, it
> insists on having the browser show the popup username/password box.  I
> tried making a simple handler function that just returns OK, but I still
> get the login box.

This the way BASIC Authentication works. To solve your problem (cleanly),
you'll need to use your own custom authentication mechanism. This is not
as hard as it sound.

Take a look at Apache::AuthCookie for an example (quite likely it is exactly
what you are looking for)

Or read chapter 13.7 "Writing your own authentication mechanism" in the
mod_perl Cookbook.


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