Sorry, I forgot to answer the questions!

RJ Herrick skrev:
> Perhaps you could post/attach your .htaccess and masonhandler.pl for
> review, as well as the full path to each. I'm not adept at Apache, so I
> can't offer any great insight into best configuration or the nature of
> specific error messages.
> 
> I highly recommend buying and reading through the mason book. Here's the
> chapter on CGI:
> http://www.masonbook.com/book/chapter-9.mhtml
> I would go through the examples there, to ensure that you pick up on any
> quirks in your particular system's implementation.
> 
> These are the steps I would proceed through in troubleshooting:
> Can you run a CGI script?

Yes.

> Can you access mason via a CGI script?

How can I test that independently of the server call?

> Can you set up a handler rule using FilesMatch? (Try just using CGI)

I probably shouldn't do that, as explained below.

> Can you set up a handler that triggers your masonhandler.pl?

I'll try if you tell me how.  I've used Perl for various
text massaging tasks for years, but CGI and Apache are new to me.

> Can you abstract the mason interfacing element from your CGI into your
> masonhandler? (based on basic example handler here:
> http://www.masonhq.com/docs/manual/CGIHandler.html )

I was told I should not use LocationMatch in an .htaccess file,
so I assumed the examples there were wrong.

> Can you access your mason components with your mason handler?

How could I test that?

> 
> hth,
> RJ

My .htaccess file looks like this:

#Define the html-mason handler (server root relative)
#Action html-mason masonhandler.pl

AddHandler html-mason .mhtml
Action html-mason masonhandler.pl

# #Public
# <FilesMatch "\.mhtml$">
#   Options +ExecCGI
#   SetHandler html-mason
# </FilesMatch>

#Private
<FilesMatch ".mas$">
    Order allow,deny
    Deny from all
</FilesMatch>

I was told that

> "Options +ExecCGI" (or any other Options directive) applies
> to *directories*, not files. So what you have said is that a
> *directory* whose name ends in ".mhtml" will contain CGI
> scripts.  Of course, that directory doesn't exist.

But now I get an error:

> 400 Bad Request
> Your browser sent a request that this server could not understand.
>
> Invalid URI in request GET /test.mhtml HTTP/1.1
>
> Additionally, a 404 Not Found error was encountered while
> trying to use an ErrorDocument to handle the request.
> Apache/1.3.36 Server at www.melroch.se Port 80

Is that the nasonhandler.pl trying to get the test.mhtml
but failing for some reason?

My masonhandler.pl looks like this:

#!/usr/bin/perl -T

use warnings;

#Untainting: Explicitly add programs as needed
$ENV{PATH} = undef;

use strict;
use HTML::Mason::CGIHandler;
# use CGI qw( escapeHTML );
use CGI::Carp qw/fatalsToBrowser/;
# use Digest::SHA1;
# use Cache::FileCache;

#Turn on profiling
#use MasonX::Profiler;

#Get a new Mason handler object
my $h = HTML::Mason::CGIHandler->new
  (
   #preamble        => 'my $p = MasonX::Profiler->new($m, $r);',
#MasonX::Profiler object
   allow_globals        => [qw( $ROOT $ThisUser )],      #globals per child
   code_cache_max_size    => 0,                             #Turn off
caching while testing
  );

#Pass the request to the handler. Ta-da!
$h->handle_request;


-- 


/BP 8^)>
--
Benct Philip Jonsson -- melroch at melroch dot se

    a shprakh iz a dialekt mit an armey un flot

                                 (Max Weinreich)



_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to