Re: modperl2 Apache::HTTP_FORBIDDEN... [long post]
Stas Bekman wrote: Shannon Eric Peevey wrote: 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. I think that this still won't work. The reason: Apache::Const-import(-compile = 'HTTP_UNAUTHORIZED','HTTP_INTERNAL_SERVER_ERROR','DECLINED','HTTP_FORBIDDEN','OK'); only compiles the constants, it doesn't import them. Drop the '-compile =' part, and then they will be imported. -compile tell Apache::Const to not import the constants but to compile them. It did work, in fact. (I was just snoozing on the job... :P ) Thanks, Randy! speeves cws
Re: modperl2 Apache::HTTP_FORBIDDEN... [long post]
Shannon Eric Peevey wrote: 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. I think that this still won't work. The reason: Apache::Const-import(-compile = 'HTTP_UNAUTHORIZED','HTTP_INTERNAL_SERVER_ERROR','DECLINED','HTTP_FORBIDDEN','OK'); only compiles the constants, it doesn't import them. Drop the '-compile =' part, and then they will be imported. -compile tell Apache::Const to not import the constants but to compile them. -- __ 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... [long post]
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 ; } } } $self - get_config ($r) ;
Re: modperl2 Apache::HTTP_FORBIDDEN... [long post]
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: modperl2 Apache::HTTP_FORBIDDEN... [long post]
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