RK> But this doesn't seem to be the problem ... What's printed in the
RK> browser? Is there anything in the error logs? Is the name of the
RK> directory to be read input from the user (if so, are you running
RK> under taint mode?), and are the permissions appropriate?
Here is my module's code...
use strict;
use Apache::Constants qw(:common);
use Apache::File ();
use IO::Dir;

sub handler {
   my $r = shift;
   return DECLINED unless $r->content_type() eq '' or $r->content_type() eq 
'text/html';

   my $file = $r->filename;
   my $tmp=substr($file,rindex($file,'/')+1,length($file)-$_-1,'');

   if (-e $r->finfo)
   {
      return DECLINED;
   }

   $r->content_type('text/plain');
   $r->send_http_header;

   my @htmls;
   my $refdir;
   opendir($refdir, "$file");
   unless ($refdir)
   {
     $r->log_error("Err in opendir($refdir,$file) : $!");
     return SERVER_ERROR;
   }
   my $filedir;
   while ($filedir = readdir($refdir))
   {
     next if (not $filedir =~/.html/);
     push(@htmls, $filedir) if (-f "$file$filedir");
   }
   closedir($refdir);

   foreach my $html(@htmls)
   {
     $html=$file.$html;

     my $fh;
     unless ($fh = Apache::File->new($file))
     {
        $r->log_error("Couldn't open $file for reading: $!");
        return SERVER_ERROR;
     }
     while (<$fh>)
     {
        $r->print($_);
     }
     $fh->close();
   }
   return OK;
}

1;
__END__

I've attached file with browser output.
ݦ.!x..¦
index.htmlÒ‘·imagesÒß·fotoÒñ·´     
style.cssÒ

Reply via email to