Pedro Melo
2010-09-08 11:33:54 UTC
Hi,
I sent this to the Mason-Users list, but I should probably use the
Mason-devel list.
Thanks,
---------- Forwarded message ----------
From: Pedro Melo <***@simplicidade.org>
Date: Tue, Sep 7, 2010 at 11:50 AM
Subject: Re: Dealing with index.html and multiple-component roots
To: mason-***@lists.sourceforge.net
Hi again,
just to experiment with the idea, I wrote this quick & dirty patch.
Its in the "it works for me but I'm not putting this into production
without more tests"-state.
---- 8< ------
diff --git a/elib/html-mason/lib/HTML/Mason/Request.pm
b/elib/html-mason/lib/HTML/Mason/Request.pm
index 003e154..4479423 100644
--- a/elib/html-mason/lib/HTML/Mason/Request.pm
+++ b/elib/html-mason/lib/HTML/Mason/Request.pm
@@ -249,6 +249,11 @@ sub _initialize {
search: {
$request_comp = $self->interp->load($path);
+ ## FIXME: index.html should be a configuration parameter
+ unless ($request_comp) {
+ $request_comp = $self->interp->load("$path/index.html");
+ }
+
last search unless $self->use_dhandlers;
# If path was not found, check for dhandler.
---- 8< ------
I sent this to the Mason-Users list, but I should probably use the
Mason-devel list.
Thanks,
---------- Forwarded message ----------
From: Pedro Melo <***@simplicidade.org>
Date: Tue, Sep 7, 2010 at 11:50 AM
Subject: Re: Dealing with index.html and multiple-component roots
To: mason-***@lists.sourceforge.net
Hi again,
just to experiment with the idea, I wrote this quick & dirty patch.
Its in the "it works for me but I'm not putting this into production
without more tests"-state.
---- 8< ------
diff --git a/elib/html-mason/lib/HTML/Mason/Request.pm
b/elib/html-mason/lib/HTML/Mason/Request.pm
index 003e154..4479423 100644
--- a/elib/html-mason/lib/HTML/Mason/Request.pm
+++ b/elib/html-mason/lib/HTML/Mason/Request.pm
@@ -249,6 +249,11 @@ sub _initialize {
search: {
$request_comp = $self->interp->load($path);
+ ## FIXME: index.html should be a configuration parameter
+ unless ($request_comp) {
+ $request_comp = $self->interp->load("$path/index.html");
+ }
+
last search unless $self->use_dhandlers;
# If path was not found, check for dhandler.
---- 8< ------
Hi,
I'm revisiting a very old Mason site (still running 1.05, I'm
upgrading it to the latest Mason) and I stumbled on something about
serving index.html files and multiple component roots.
This sites uses a "common" and "channel" component setup. Its the same
basic site, shared with different output channels. Each channel has
its on component root and it appears first in the list of component
roots, so that each site can override the common one.
The Apache document root points to the channel document root, and the
Apache configuration uses a DocumentIndex directive to set the
index.html file as the one to get on directory URLs.
But if I move all index.html components to the common component root
(outside the Apache document root), the /dir/ => /dir/index.html
internal rewrite will not happen, because there is no /dir/ nor
/dir/index.html in the Apache document root.
The question is: do you have a similar setup that is working? If so how?
I searched the docs and I found about decline_dirs setting that might
help me but it seems that I would need to create a dhandler for each
directory where I have an index.html file.
Looking at the code it seems that Mason doesn't deal with this
situation at all. Maybe moving the Apache "DirectoryIndex" setting to
Mason would make some sense, given that right now it doesn't seem to
be able to deal with multiple component roots? If so, would you accept
a patch for it?
Thanks in advance,
I'm revisiting a very old Mason site (still running 1.05, I'm
upgrading it to the latest Mason) and I stumbled on something about
serving index.html files and multiple component roots.
This sites uses a "common" and "channel" component setup. Its the same
basic site, shared with different output channels. Each channel has
its on component root and it appears first in the list of component
roots, so that each site can override the common one.
The Apache document root points to the channel document root, and the
Apache configuration uses a DocumentIndex directive to set the
index.html file as the one to get on directory URLs.
But if I move all index.html components to the common component root
(outside the Apache document root), the /dir/ => /dir/index.html
internal rewrite will not happen, because there is no /dir/ nor
/dir/index.html in the Apache document root.
The question is: do you have a similar setup that is working? If so how?
I searched the docs and I found about decline_dirs setting that might
help me but it seems that I would need to create a dhandler for each
directory where I have an index.html file.
Looking at the code it seems that Mason doesn't deal with this
situation at all. Maybe moving the Apache "DirectoryIndex" setting to
Mason would make some sense, given that right now it doesn't seem to
be able to deal with multiple component roots? If so, would you accept
a patch for it?
Thanks in advance,
--
Pedro Melo
http://www.simplicidade.org/
xmpp:***@simplicidade.org
mailto:***@simplicidade.org
Pedro Melo
http://www.simplicidade.org/
xmpp:***@simplicidade.org
mailto:***@simplicidade.org