Fix RT#78377 - IIS7 sucks in different ways to IIS6
Tomas Doran [Wed, 18 Jul 2012 20:05:44 +0000 (21:05 +0100)]
Changes
Makefile.PL
lib/Catalyst.pm

diff --git a/Changes b/Changes
index 02cb8cb..baf322f 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,10 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+  - Fix RT#78377 - IIS7 ignores response body for 3xx requests, which
+    causes (a different) response to be broken when using keepalive.
+    Fixed by applying Middleware which removes the response body and
+    content length that Catalyst supplies with redirects.
+
 5.90015 - 2012-06-30 16:57:00
   - Fix $c->finalize_headers getting called twice. RT#78090
   - Fix test fails in Catalyst-Plugin-Session-State-Cookie. RT#76179
index 4b83510..c8ff69a 100644 (file)
@@ -67,7 +67,7 @@ requires 'MooseX::Getopt' => '0.30';
 requires 'MooseX::Types';
 requires 'MooseX::Types::Common::Numeric';
 requires 'String::RewritePrefix' => '0.004'; # Catalyst::Utils::resolve_namespace
-requires 'Plack' => '0.9974'; # IIS6 fix middleware
+requires 'Plack' => '0.9991'; # IIS6+7 fix middleware
 requires 'Plack::Middleware::ReverseProxy' => '0.04';
 requires 'Plack::Test::ExternalServer';
 
index 7009a53..2f6fe22 100644 (file)
@@ -36,6 +36,7 @@ use Try::Tiny;
 use Plack::Middleware::Conditional;
 use Plack::Middleware::ReverseProxy;
 use Plack::Middleware::IIS6ScriptNameFix;
+use Plack::Middleware::IIS7KeepAliveFix;
 use Plack::Middleware::LighttpdScriptNameFix;
 
 BEGIN { require 5.008003; }
@@ -2793,6 +2794,16 @@ sub apply_default_middlewares {
     # IIS versions
     $psgi_app = Plack::Middleware::IIS6ScriptNameFix->wrap($psgi_app);
 
+    # And another IIS issue, this time with IIS7.
+    $psgi_app = Plack::Middleware::Conditional->wrap(
+        $psgi_app,
+        builder => sub { Plack::Middleware::IIS7KeepAliveFix->wrap($_[0]) },
+        condition => sub {
+            my ($env) = @_;
+            return unless $env->{SERVER_SOFTWARE} && $env->{SERVER_SOFTWARE} =~ m!IIS\/7\.[0-9]!; 1; }, );
+        },
+    );
+
     return $psgi_app;
 }