X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=fd22ff06b92dcb5abb9bad48074ae5fa1c66f32a;hb=0bf2648c4dcbd7fc6b97b67701ba1425478a6ef9;hp=564cb42447dd573abc234c6e8ac70911efb6305b;hpb=933ba40380c86f9642bcfbee446a04d48efe4544;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 564cb42..fd22ff0 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -20,6 +20,11 @@ use overload '""' => sub { return ref shift }, fallback => 1; # Amount of data to read from input on each pass our $CHUNKSIZE = 64 * 1024; +# See if we can use libapreq2 for URI unescaping +use constant HAS_APR => eval { + require APR::Request; +}; + =head1 NAME Catalyst::Engine - The Catalyst Engine @@ -636,14 +641,19 @@ sub write { =head2 $self->unescape_uri($uri) -Unescapes a given URI using the most efficient method available. Engines such -as Apache may implement this using Apache's C-based modules, for example. +Unescapes a given URI using the most efficient method available. Engines +can subclass to provide faster implementations. =cut sub unescape_uri { my $self = shift; + if ( HAS_APR ) { + # This function is ~12x faster than URI::Escape + return APR::Request::decode(@_); + } + my $e = URI::Escape::uri_unescape(@_); $e =~ s/\+/ /g;