File Coverage

blib/lib/Plack/Middleware/IIS7KeepAliveFix.pm
Criterion Covered Total %
statement 19 21 90.4
branch 2 4 50.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 27 31 87.1


line stmt bran cond sub pod time code
1             package Plack::Middleware::IIS7KeepAliveFix;
2              
3 1     1   20093 use strict;
  1         2  
  1         26  
4 1     1   5 use parent 'Plack::Middleware';
  1         1  
  1         4  
5 1     1   36 use Plack::Util;
  1         2  
  1         131  
6              
7             sub call {
8 1     1 1 4 my($self, $env) = @_;
9             # Fixes buffer being cut off on redirect when keep-alive is active
10 1         7 my $res = $self->app->($env);
11              
12             Plack::Util::response_cb($res, sub {
13 1     1   2 my $res = shift;
14 1 50       13 if ($res->[0] =~ m!^30[123]$! ) {
15 1         4 Plack::Util::header_remove($res->[1], 'Content-Length');
16 1         12 Plack::Util::header_remove($res->[1], 'Content-Type');
17 1 50       5 return sub{ my $chunk; return unless defined $chunk; return ''; };
  2         4  
  2         6  
  0            
18             }
19              
20 0           return;
21 1         244 });
22              
23             }
24              
25             1;
26             __END__