Skip Menu |

This queue is for tickets about the CGI-Application-Dispatch CPAN distribution.

Report information
The Basics
Id: 28979
Status: resolved
Priority: 0/
Queue: CGI-Application-Dispatch

People
Owner: Nobody in particular
Requestors: GTERMARS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: Fatal exception thrown under Mod_perl2 if a "bad request" issued
When using CAP::Dispatch in combination with Mod_perl2, if you issue a "bad request" (e.g. by sending invalid characters in a module name), CAP::Dispatch throws a "500 - Internal Server Error". This gets logged in the Apache error log to the effect of: Undefined subroutine &CGI::Application::Dispatch::BAD_REQUEST called at ... Did a bit of poking through 2.10, and see that this is due to the way that Mod_perl2 names the "bad request" constant; previous versions named it "BAD_REQUEST", while under Mod_perl2 its named "HTTP_BAD_REQUEST". The attached patch addresses this by fixing up the return code when we want to return "the http bad request response"; under Mod_perl2 it now returns "HTTP_BAD_REQUEST" while for everything else it continues to return "BAD_REQUEST".
Subject: cap-dispatch-bad-request-modperl2.patch
diff -rc CGI-Application-Dispatch-2.10.orig/lib/CGI/Application/Dispatch.pm CGI-Application-Dispatch-2.10/lib/CGI/Application/Dispatch.pm *** CGI-Application-Dispatch-2.10.orig/lib/CGI/Application/Dispatch.pm 2007-01-15 06:03:05.000000000 -0800 --- CGI-Application-Dispatch-2.10/lib/CGI/Application/Dispatch.pm 2007-08-24 09:42:27.549666502 -0700 *************** *** 671,677 **** } elsif( $r->status == 500 ) { return SERVER_ERROR(); } elsif( $r->status == 400 ) { ! return BAD_REQUEST(); } else { return OK(); } --- 671,677 ---- } elsif( $r->status == 500 ) { return SERVER_ERROR(); } elsif( $r->status == 400 ) { ! return IS_MODPERL_2 ? HTTP_BAD_REQUEST() : BAD_REQUEST(); } else { return OK(); }
Gee... it'd help if I actually -tested- that patch, wouldn't it... Re-attached, with fixed "IS_MODPERL2()" constant name. Can verify that the test suites run successfully with this version of the patch.
diff -rc CGI-Application-Dispatch-2.10.orig/lib/CGI/Application/Dispatch.pm CGI-Application-Dispatch-2.10/lib/CGI/Application/Dispatch.pm *** CGI-Application-Dispatch-2.10.orig/lib/CGI/Application/Dispatch.pm 2007-01-15 06:03:05.000000000 -0800 --- CGI-Application-Dispatch-2.10/lib/CGI/Application/Dispatch.pm 2007-08-24 09:42:27.549666502 -0700 *************** *** 671,677 **** } elsif( $r->status == 500 ) { return SERVER_ERROR(); } elsif( $r->status == 400 ) { ! return BAD_REQUEST(); } else { return OK(); } --- 671,677 ---- } elsif( $r->status == 500 ) { return SERVER_ERROR(); } elsif( $r->status == 400 ) { ! return IS_MODPERL2() ? HTTP_BAD_REQUEST() : BAD_REQUEST(); } else { return OK(); }
Fixed in the upcoming 2.11