Handler is preventing redirects on missing trailing / ?

2000-10-11 Thread Clayton Mitchell

I installed a handler as such:


httpsd.conf:
-
PerlModule Tofu::Tofuhandler

SetHandler perl-script
PerlHandler Tofu::Tofuhandler



AddHandler perl-script *.html
PerlHandler Tofu::Tofuhandler


I then noticed that URI's of directories lacking a trailing '/' were not
being redirected in the browser and so relative links started to break.

As a w/o I installed a TransHandler listed below to modify the URI.   It
seems like I am re-inventing the wheel here and so I assume I did something
wrong to get to this point?  
Thanks for any advice.


package Tofu::Tofugruff;

#use Apache::Constants qw(:common);
use Apache::Constants qw(:response);

use strict;


 sub handler {
my $r = shift;
my $f = $r->document_root.$r->uri;
my $uri = $r->uri;
if ( -d $f && $f !~/.*\/$/ ) {
   # A directory that doesn't end in a '/'
   $uri.='/';  # fix it
   $r->err_header_out("Pragma", "no-cache");
   $r->header_out("Location" => $uri );
   $r->status(REDIRECT);
   return DECLINED;
}
return DECLINED;
 }

1;
__END__





Where's the filehandle in a PerlHandler module?

2000-09-27 Thread Clayton Mitchell

Sorry to ask such a newbie question, but I can't figure this out.

In a handler I want to process all requests and parse the document
requested and spit it out after marking it up.

I have put in place this code, but I don't see how to access the actual
requested document.

I'm hoping there's already an open filehandle to it somewhere?

##   a simple handler - but doesn't print the actual requested
document.
package _Parse;

sub handler {
  my $r = shift;
   my $symname;
  $r->content_type("text/html");
  $r->send_http_header;
  $r->print("header text\n");

   # this doesn't work ---
  while (<>) {
$r->print;
$_->print;
  }
  # this prints the environment variables
   foreach $key (keys %ENV) {
 print "$key: $ENV{$key}";
 print "";
   }

  }
  1;





Apache.pm failed to load

2000-08-21 Thread Clayton Mitchell

I think I followed the directions, and I also added "PerlModule Apache" in
httpd.conf,

but I still get the error "Apache.pm failed to load!."  when trying to start
httpsd.

I am on Sol 2.7, gcc 2.8.1 apache-1.3.12 and openssl_0.9.5 and
mod_perl-1.24.

I have performed the steps outlined in this page with the exception noted
below.

Any help is greatly appreciated.

http://perl.apache.org/guide/install.html#Source_Configuration_perl_Makef

Under the section for 

mod_perl and apache-ssl (+openssl)
  
Configure and install openssl: 

% cd openssl-x.x.x
% ./config
% make && make test && make install


Patch Apache with SSLeay paths 
  
% cd apache_x.xx
% tar xzvf ../apache_x.x.x+ssl_x.xx.tar.gz
% FixPatch
Do you want me to apply the fixed-up Apache-SSL patch for you?
[n] y


Now edit the src/Configuration file if needed and then configure: 
  
% cd ../mod_perl-x.xx
% perl Makefile.PL USE_APACI=1 EVERYTHING=1 \
  DO_HTTPD=1 SSL_BASE=/usr/local/ssl \
  APACHE_SRC=../apache_x.x.x/src


Build, test and install:  
  
% make && make test && make install
% cd ../apache_x.x.x
% make certificate
% make install

> make cert and make install steps I skipped.  I had a prior version of
apache-ssl I am replacing.

Here is what the perl library has:

# find /opt/local/lib/perl5 -name Apache
/opt/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Apache
/opt/local/lib/perl5/site_perl/5.005/Apache
# ls /opt/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Apache
AuthenSmb  Sandwich
# ls /opt/local/lib/perl5/site_perl/5.005/Apache
AuthenSmb.pm  Sandwich.pm
# find /opt/local/lib/perl5 -name Apache.pm
/opt/local/lib/perl5/5.00503/CGI/Apache.pm
# cp /opt/local/lib/perl5/5.00503/CGI/Apache.pm .

..still didn't work.