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
         $r->custom_response(Apache2::Const::HTTP_REQUEST_ENTITY_TOO_LARGE,
"File too large|Bye");
    } elsif ($r->uri =~ /def/) {
          $r->content_type('text/xml');
          
$r->custom_response(Apache2::Const::HTTP_REQUEST_ENTITY_TOO_LARGE,"<xml><message>Bad
request</message></xml>");
   }
   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 <markjr...@gmail.com>

Reply via email to