We've had issues like this before.  But it usually boiled down to apache not 
realizing the intended function or target file was to be parsed by Mason before 
responding to the client, and apache just defaults to assuming plain text or 
html content when it doesn't see any configuration for processing it.  In our 
app, we don't use Mason's templating features, we just use it as an extension 
to mod_perl's app framework, and use HTML::Template, thus allowing for ease of 
separating content from source code from templates.  Our configuration is as 
follows:


    # HTML::Mason Configuration:

      # The PerlModule directive below simply ensures that the mdoule code is 
loaded in the
      # parent process before forking, which can save some memory.
        PerlModule HTML::Mason::ApacheHandler

      # Match the specific functions of the site
        <LocationMatch "^/+(home|search|help.*|error.*)$">   # Put your 
function names here
          SetHandler perl-script
          PerlHandler HTML::Mason::ApacheHandler
        </LocationMatch>

      # Match all *.mpl files
      # Mostly used for secret pages that we were too lazy to set up an alias 
for
        <LocationMatch "\.(mpl)$">
          SetHandler perl-script
          PerlHandler HTML::Mason::ApacheHandler
        </LocationMatch>

You could easily replace the \.(mpl)  with \.(html), etc.


Then we use mod_alias to hide the real mason components as follows

Alias    /home    /path_to_your_app/cgi-bin/home/index.mpl

.. or, in your case,

Alias    /search    /path_to_your_app/cgi-bin/search.html


... and thus the publicly available function names would be
   /home
   /search

   etc.

Hope this helps,
- Jeff


----- Original Message ----
From: "Meyers, Daniel" <[EMAIL PROTECTED]>
To: mason-users@lists.sourceforge.net
Sent: Tuesday, February 6, 2007 2:50:57 AM
Subject: [Mason] Mason displaying source code if you miss off the extension?

Please excuse me if this question has already been answered, or is
ludicrously simple to fix. I couldn't find it in the FAQ or mailing list
archives, and I'm new to Mason, trying to admin a webserver using Mason
code that was originally written by someone else.

Anyway, my issue is thus - The site in question uses many webpages that
have perl code embedded using mason. All works fine if the pages are
linked to correctly, e.g. www.blah.com/search.html (not a real page,
obviously) The code can execute, the page is displayed correctly, and
you must login using a valid username and password (obtained via radius,
if it matters) to view the page. However, if you miss off the file
extension and try to browse to www.blah.com/search then things get
interesting. The page is displayed as part perl source (within Mason '<'
'>' tags which are also displayed, as if the page has not been parsed
but instead just displayed as plain text), part parsed HTML, so text
boxes and such appear. You don't need to login to get to this
source-code page either. The behaviour I would have expected would be to
display a 404 error page as the file couldn't be found.

Some poking has suggested that this is the result of something being
done by mod_rewrite within Mason. mod_rewrite has no configuration in
the base apache webserver, and turning the RewriteEngine off makes no
difference to the issue, but if I prevent the module from being loaded
*at all* then the site breaks entirely, and starts giving 500 Server
Errors in response to any page requested (all of which contain code run
via Mason). There is no file present in the directory called simply
'search', so it's not like it's loading that. I can't work out why I'm
not getting the expected 404 error, and was wondering if anyone else had
experienced the same thing and found out why it was occurring.

Many Thanks

-- 
Dan Meyers
Network Support
Lancaster University

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to