merged after conflict resolution
John Napiorkowski [Wed, 12 Jun 2013 14:27:20 +0000 (10:27 -0400)]
1  2 
Makefile.PL
lib/Catalyst.pm
t/lib/TestApp.pm

diff --combined Makefile.PL
@@@ -48,6 -48,7 +48,6 @@@ requires 'HTTP::Headers' => '1.64'
  requires 'HTTP::Request' => '5.814';
  requires 'HTTP::Response' => '5.813';
  requires 'HTTP::Request::AsCGI' => '1.0';
 -requires 'LWP::UserAgent';
  requires 'Module::Pluggable' => '3.9';
  requires 'Path::Class' => '0.09';
  requires 'Scalar::Util';
@@@ -58,6 -59,7 +58,6 @@@ requires 'Tree::Simple' => '1.15'
  requires 'Tree::Simple::Visitor::FindByPath';
  requires 'Try::Tiny';
  requires 'Safe::Isa';
 -requires 'URI' => '1.35';
  requires 'Task::Weaken';
  requires 'Text::Balanced'; # core in 5.8.x but mentioned for completeness
  requires 'MRO::Compat';
@@@ -67,21 -69,16 +67,21 @@@ requires 'Devel::InnerPackage'; # No lo
  requires 'Plack' => '0.9991'; # IIS6+7 fix middleware
  requires 'Plack::Middleware::ReverseProxy' => '0.04';
  requires 'Plack::Test::ExternalServer';
 +requires 'Class::Data::Inheritable';
 +requires 'Encode' => '2.49';
 +requires 'LWP' => '5.837'; # LWP had unicode fail in 5.8.26
 +requires 'URI' => '1.36';
  
  # Install the standalone Regex dispatch modules in order to ease the
  # depreciation transition
  requires 'Catalyst::DispatchType::Regex' => '5.90021';
  
 -test_requires 'Class::Data::Inheritable';
  test_requires 'Test::Exception';
  test_requires 'Test::More' => '0.88';
  test_requires 'Data::Dump';
  test_requires 'HTTP::Request::Common';
 +test_requires 'IO::Scalar';
 +test_requires 'HTTP::Status';
  
  # aggregate tests if AGGREGATE_TESTS is set and a recent Test::Aggregate and a Test::Simple it works with is available
  my @author_requires;
@@@ -97,7 -94,7 +97,8 @@@ else 
  
  push(@author_requires, 'CatalystX::LeakChecker', '0.05');
  push(@author_requires, 'Catalyst::Devel', '1.0'); # For http server test
 +push(@author_requires, 'Test::WWW::Mechanize::Catalyst', '0.51');
+ push(@author_requires, 'Test::TCP', '1.27'); # ditto, ships Net::EmptyPort
  
  author_tests('t/author');
  author_requires(
    Test::Pod::Coverage
    Test::Spelling
    Pod::Coverage::TrustPod
 +  Catalyst::Plugin::Params::Nested
  ));
  
  if ($Module::Install::AUTHOR) {
@@@ -125,6 -121,7 +126,7 @@@ resources
      'IRC'         => 'irc://irc.perl.org/#catalyst',
      'license',    => 'http://dev.perl.org/licenses/',
      'homepage',   => 'http://dev.catalyst.perl.org/',
+     # r/w: catagits@git.shadowcat.co.uk:Catalyst-Runtime.git
      'repository', => 'git://git.shadowcat.co.uk/catagits/Catalyst-Runtime.git',
  );
  
diff --combined lib/Catalyst.pm
@@@ -1793,6 -1793,14 +1793,14 @@@ sub finalize 
          $c->log->error($error);
      }
  
+     # Support skipping finalize for psgix.io style 'jailbreak'.  Used to support
+     # stuff like cometd and websockets
+     
+     if($c->request->has_io_fh) {
+       $c->log_response;
+       return;
+     }
      # Allow engine to handle finalize flow (for POE)
      my $engine = $c->engine;
      if ( my $code = $engine->can('finalize') ) {
@@@ -2974,26 -2982,10 +2982,26 @@@ the plugin name does not begin with C<C
          return $class;
      }
  
 +    sub _default_plugins { return qw(Unicode::Encoding) }
 +
      sub setup_plugins {
          my ( $class, $plugins ) = @_;
  
          $class->_plugins( {} ) unless $class->_plugins;
 +        $plugins = [ grep {
 +            m/Unicode::Encoding/ ? do {
 +                $class->log->warn(
 +                    'Unicode::Encoding plugin is auto-applied,'
 +                    . ' please remove this from your appclass'
 +                    . ' and make sure to define "encoding" config'
 +                );
 +                unless (exists $class->config->{'encoding'}) {
 +                  $class->config->{'encoding'} = 'UTF-8';
 +                }
 +                () }
 +                : $_
 +        } @$plugins ];
 +        unshift @$plugins, $class->_default_plugins;
          $plugins = Data::OptList::mkopt($plugins || []);
  
          my @plugins = map {
@@@ -3191,12 -3183,19 +3199,23 @@@ C<< $c->request->base >> will be incorr
  
  C<using_frontend_proxy> - See L</PROXY SUPPORT>.
  
 +=item *
 +
 +C<encoding> - See L</ENCODING>
 +
  =back
  
+ =item abort_chain_on_error_fix => 1
+ When there is an error in an action chain, the default behavior is to continue
+ processing the remaining actions and then catch the error upon chain end.  This
+ can lead to running actions when the application is in an unexpected state.  If
+ you have this issue, setting this config value to true will promptly exit a
+ chain when there is an error raised in any action (thus terminating the chain 
+ early.)
+ In the future this might become the default behavior.
  =head1 INTERNAL ACTIONS
  
  Catalyst uses internal actions like C<_DISPATCH>, C<_BEGIN>, C<_AUTO>,
@@@ -3286,53 -3285,6 +3305,53 @@@ If you plan to operate in a threaded en
  modules you are using must also be thread-safe. Some modules, most notably
  L<DBD::SQLite>, are not thread-safe.
  
 +=head1 ENCODING
 +
 +On request, decodes all params from encoding into a sequence of
 +logical characters. On response, encodes body into encoding.
 +
 +=head2 Methods
 +
 +=over 4
 +
 +=item encoding
 +
 +Returns an instance of an C<Encode> encoding
 +
 +    print $c->encoding->name
 +
 +=item handle_unicode_encoding_exception ($exception_context)
 +
 +Method called when decoding process for a request fails.
 +
 +An C<$exception_context> hashref is provided to allow you to override the
 +behaviour of your application when given data with incorrect encodings.
 +
 +The default method throws exceptions in the case of invalid request parameters
 +(resulting in a 500 error), but ignores errors in upload filenames.
 +
 +The keys passed in the C<$exception_context> hash are:
 +
 +=over
 +
 +=item param_value
 +
 +The value which was not able to be decoded.
 +
 +=item error_msg
 +
 +The exception received from L<Encode>.
 +
 +=item encoding_step
 +
 +What type of data was being decoded. Valid values are (currently)
 +C<params> - for request parameters / arguments / captures
 +and C<uploads> - for request upload filenames.
 +
 +=back
 +
 +=back
 +
  =head1 SUPPORT
  
  IRC:
@@@ -3506,7 -3458,7 +3525,7 @@@ Will Hawes C<info@whawes.co.uk
  
  willert: Sebastian Willert <willert@cpan.org>
  
 -wreis: Wallace Reis <wallace@reis.org.br>
 +wreis: Wallace Reis <wreis@cpan.org>
  
  Yuval Kogman, C<nothingmuch@woobling.org>
  
diff --combined t/lib/TestApp.pm
@@@ -50,7 -50,7 +50,8 @@@ TestApp->config
              action_action_nine => { another_extra_arg => 13 }
          }
      },
 +    encoding => 'UTF-8',
+     abort_chain_on_error_fix => 1,
  );
  
  # Test bug found when re-adjusting the metaclass compat code in Moose