[Fwd: [Maypole] CGI::Maypole default page handling]

Dave Howorth dhoworth@mrc-lmb.cam.ac.uk
Thu, 28 Oct 2004 16:16:02 +0100


I see this change didn't make it into v2. I'd like to rerequest it and 
here it is as a patch:

@@ -20,6 +20,7 @@
      $self->{path} = $self->{cgi}->url( -absolute => 1, -path_info => 1 );
      my $loc = $self->{cgi}->url( -absolute => 1 );
      no warnings 'uninitialized';
+    $self->{path} .= '/' if $self->{path} eq $loc;
      $self->{path} =~ s/^($loc)?\///;
      $self->parse_path;
      $self->parse_args;

Cheers, Dave

-------- Original Message --------
Subject: [Maypole] CGI::Maypole default page handling
Date: Wed, 15 Sep 2004 16:09:49 +0100
From: Dave Howorth <dhoworth@mrc-lmb.cam.ac.uk>

When using a system based on CGI::Maypole, if a user types:

    http://localhost/cgi-bin/beer.cgi/

they see the frontpage of the database. But if they type

    http://localhost/cgi-bin/beer.cgi

they see something like "Internal Server Error".

It seems unreasonable to penalise the user so hard for leaving off a
slash, so I've added a line to CGI::Maypole::parse_location():

    $self->{path} .= '/' if $self->{path} eq $loc;

I added this just after the "no warnings" line and it works for me. Can
anybody see a problem?  If not, I'd like to propose it for the next version.

Cheers, Dave