more middleware, more listed deprecations
John Napiorkowski [Thu, 23 Jan 2014 02:27:09 +0000 (20:27 -0600)]
Changes
Makefile.PL
lib/Catalyst.pm
lib/Catalyst/ActionRole/HTTPMethods.pm
lib/Catalyst/Delta.pod

diff --git a/Changes b/Changes
index 8986e52..fff9ec2 100644 (file)
--- a/Changes
+++ b/Changes
@@ -9,11 +9,11 @@
   - Added some backcompat code when setting a response body to an object
     that does 'read' but not 'getline'.  Added deprecation notice for this
     case.  Added docs to Catalyst::Delta.
-  - Official warning that Catalyst::Engine::PSGI is no longer supported and
-    we will be removing any existing backcompat code for this engine in a
-    future release.  Other deprecations noted, see Catalyst::Delta.
-  - $c->res->has_body is now considered true if you've even once requested a
-    $c->res->write_fh or called $c->res->write.
+  - Catalyst::Delta contains a list of behaviors which will be considered
+    deprecated immediatelty.  Most items have workarounds and tweaks you can
+    make to avoid issues.  These deprecations are targeted for removal/enforcement
+    in the Catalyst 6 release.  Please review and give your feedback.
+  - More middleware to replace inline code (upasana++)  
 
 5.90059_003 - 2013-12-24
   - More documentation about alternative ways to setup middleware.
index 01ea024..4faab4e 100644 (file)
@@ -83,6 +83,7 @@ requires "Plack::Middleware::ContentLength";
 requires "Plack::Middleware::Head";
 requires "Plack::Middleware::HTTPExceptions";
 requires "Plack::Middleware::FixMissingBodyInRedirect";
+requires "Plack::Middleware::MethodOverride;
 
 test_requires 'Test::Fatal';
 test_requires 'Test::More' => '0.88';
index 499e49a..1cd7de6 100644 (file)
@@ -45,6 +45,7 @@ use Plack::Middleware::ContentLength;
 use Plack::Middleware::Head;
 use Plack::Middleware::HTTPExceptions;
 use Plack::Middleware::FixMissingBodyInRedirect;
+use Plack::Middleware::MethodOverride;
 use Plack::Util;
 use Class::Load 'load_class';
 
@@ -3114,6 +3115,7 @@ sub registered_middlewares {
           Plack::Middleware::HTTPExceptions->new,
           Plack::Middleware::FixMissingBodyInRedirect->new,
           Plack::Middleware::ContentLength->new,
+          Plack::Middleware::MethodOverride->new,
           Plack::Middleware::Head->new,
           @$middleware);
     } else {
index 8d9033d..8b9eef8 100644 (file)
@@ -6,20 +6,12 @@ requires 'match', 'match_captures', 'list_extra_info';
 
 around ['match','match_captures'] => sub {
   my ($orig, $self, $ctx, @args) = @_;
-  my $expected = $self->_normalize_expected_http_method($ctx->req);
+  my $expected = $ctx->req->method;
   return $self->_has_expected_http_method($expected) ?
     $self->$orig($ctx, @args) :
     0;
 };
 
-sub _normalize_expected_http_method {
-  my ($self, $req) = @_;
-  return $req->header('X-HTTP-Method') ||
-    $req->header('X-HTTP-Method-Override') ||
-    $req->header('X-METHOD-OVERRIDE') ||
-    $req->header('x-tunneled-method') ||
-    $req->method;
-}
 
 sub _has_expected_http_method {
   my ($self, $expected) = @_;
@@ -75,27 +67,12 @@ This is an action role that lets your L<Catalyst::Action> match on standard
 HTTP methods, such as GET, POST, etc.
 
 Since most web browsers have limited support for rich HTTP Method vocabularies
-we also support setting the expected match method via the follow non standard
-but widely used http extensions.  Our support for these should not be taken as
-an endorsement of the technique.   Rt is merely a reflection of our desire to
-work well with existing systems and common client side tools.
-
-=over 4
-
-=item X-HTTP-Method (Microsoft)
-
-=item X-HTTP-Method-Override (Google/GData)
-
-=item X-METHOD-OVERRIDE (IBM)
-
-=item x-tunneled-method (used in many other similar systems on CPAN
-
-=back 
-
-Please note the insanity of overriding a GET request with a DELETE override...
-Rational practices suggest that using POST with overrides to emulate PUT and
-DELETE can be an acceptable way to deal with client limitations and security
-rules on your proxy server. I recommend going no further.
+we use L<Plack::Middleware::MethodOverride> which allows you to 'tunnel' your
+request method over POST  This works in two ways.  You can set an extension
+HTTP header C<X-HTTP-Method-Override> which will contain the value of the
+desired request method, or you may set a search query parameter
+C<x-tunneled-method>.  Remember, these only work over HTTP Request type
+POST.  See L<Plack::Middleware::MethodOverride> for more.
 
 =head1 REQUIRES
 
index 1c3de6e..c110f27 100755 (executable)
@@ -100,7 +100,9 @@ your code and / or upgrade to a newer version of L<Catalyst>
 Setting $c->res->body to a filehandle after using $c->res->write or
 $c->res->write_fh is no longer considered allowed, since we can't send
 the filehandle to the underlying Plack handler.  For now we will continue
-to support setting body to a simple value since 
+to support setting body to a simple value since this is possible, but at
+some future release a choice to use streaming indicates that you will do
+so for the rest of the request.
 
 =head2 VERSION 5.90053