perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark J. Reed" <>
Subject Re: Suggestion on perl handler to reject request with large content length
Date Fri, 19 Nov 2010 02:33:32 GMT
Accidental tab strikes again.  Anyway, the idea is to set up the
handler to run before LimitRequestBody, if possible.  I'm not sure
what hook that is.

If you can do that, then something like this would work:

 sub handler {
    my $r = shift;
    if ($r->uri =~ /abc/) {
         $r->content_type('text/plain); # API will override this if it
gets past the LimitRequestBody
"File too large|Bye");
    } elsif ($r->uri =~ /def/) {
   return Apache2::Const::OK

That way you don't have to duplicate the logic of the check yourself,
you're just arranging for a customized response when it fails.

Mark J. Reed <>

View raw message