On Sep 20, 2007, at 5:50 AM, Will Hawes wrote:

1) The unexpected matching of URLs like "/static1" (as well as the expected "/static/1") seems to be because no trailing slash is used in the regular expression that performs the match:

my $re = ( $dir =~ m{^qr/}xms ) ? eval $dir : qr/^${dir_re}/;

Perhaps this is by design, but adding the trailing slash to appears to fix the problem while still allowing files to be served from the specified static directories:

my $re = ( $dir =~ m{^qr/}xms ) ? eval $dir : qr/^${dir_re}\//;

I assume the trailing slash could be added to each item in "dirs" in my config to achieve the same effect. I haven't tested that but even if there's a good reason not to modify the regex, I think the behaviour should be documented in ::Static::Simple.

2) When a non-existent static file is requested, Firefox tries to download a PL file rather than displaying a 404 message. This appears to be because ::Static::Simple sets $c->res->status to 404, but does not set a content type. This causes content-type to be auto-detected as "text/x-perl", which in turn makes Firefox want to download the file. Hacking ::Static::Simple to set $c->res- >content_type manually to "text/html" fixes the problem.

I can't see why the standard behaviour in either case above would be by design. Are these valid problems I've highlighted and what do you think of the suggested fixes?

I've pushed Static::Simple 0.20 with these fixes. URLs like /static1 in your case will now be handled by Cat instead of S::S and 404 will have a text/html content-type.

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to