Apache::AxKit::Plugin::NotFoundIfPathInfo - return 404 (NOT FOUND) if


Apache-AxKit-Plugin-NotFoundIfPathInfo documentation Contained in the Apache-AxKit-Plugin-NotFoundIfPathInfo distribution.

Index


Code Index:

NAME

Top

Apache::AxKit::Plugin::NotFoundIfPathInfo - return 404 (NOT FOUND) if PATH_INFO is present.

SYNOPSIS

Top

  AxAddPlugin Apache::AxKit::Plugin::NotFoundIfPathInfo

DESCRIPTION

Top

This module is a very simple plugin for AxKit that returns NOT_FOUND if PATH_INFO has length. It is (obviously) incompatible with modules that depend on PATH_INFO. (i.E. Apache::AxKit::StyleChooser::PathInfo)

Given you have /this/is/myfile.html on your server and someone requests GET /this/is/myfile.html/bla/bla, AxKit will happily serve myfile.html and put /bla/bla in the PATH_INFO. This behaviour can get anoying under circumstances: Someone creates a loop with broken relative links and a stupid webspider starts to crawl through these...

BUGS

Top

None known at this time.

SEE ALSO

Top

AxKit

http://www.axkit.org/

http://www.axkitbook.com/

AUTHOR

Top

Hansjoerg Pehofer, <hansjoerg.pehofer@uibk.ac.at>

COPYRIGHT AND LICENSE

Top


Apache-AxKit-Plugin-NotFoundIfPathInfo documentation Contained in the Apache-AxKit-Plugin-NotFoundIfPathInfo distribution.

package Apache::AxKit::Plugin::NotFoundIfPathInfo;

use strict;
use Apache::Constants qw(OK NOT_FOUND);
use Apache::Request;

our $VERSION = '1.01';

sub handler {
    my $r = shift;
    if (length($r->path_info)) {
        $r->log->error("File does not exist: " . $r->filename . $r->path_info);
        return NOT_FOUND;
    }
    else {
        return OK;
    }
}

1;
__END__