Re: Inconsistency with dhandlers

David Wheeler <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On May 21, 2004, at 1:53 PM, David Wheeler wrote:

> The argument is that the way Mason currently behaves is _wrong_. If I 
> request /foo, and /foo/dhandler responds, then any relative URLs in 
> /foo/dhaneler will use / as the relative base, instead of /foo. The 
> solutions I'm proposing are all workarounds. If Mason is going to 
> handle directory requests, it needs to do the right thing with them.

Here's the patch to make 1.30 do the right thing:

--- ApacheHandler.pm.~1.309.~	Tue Mar  9 13:57:34 2004
+++ ApacheHandler.pm	Mon Jun 14 18:09:25 2004
@@ -12,7 +12,7 @@
  #
  package HTML::Mason::Request::ApacheHandler;

-use Apache::Constants qw( REDIRECT );
+use Apache::Constants qw( REDIRECT DIR_MAGIC_TYPE );

  use HTML::Mason::Request;
  use Class::Container;
@@ -781,6 +781,8 @@
  sub handle_request
  {
      my ($self, $r) = @_;
+
+    return DECLINED if $r->content_type eq DIR_MAGIC_TYPE && $r->uri 
!~ m{/$};

      my $req = $self->prepare_request($r);
      return $req unless ref($req);

Regards,

David



-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.